Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix this ImportError: No module named win32api? (win32api path variable)

I'm new to programming and computer world. I'm trying to study biomolecular simulations with MMTK.

I run it in Windows 7 and I have already installed this software:

  • python-2.5.4
  • numpy-1.6.2-win32-superpack-python2.5
  • netCDF4-0.8.2.win32-py2.5
  • ScientificPython-2.9.0.win32-py2.5
  • MMTK-2.6.0.win32-py2.5

When I run this protein.py mmtk sample, all seems to be OK. It show the numbers of 1000 process steps.

But when I run a script with view method, like this:

from MMTK import *
molecule = Molecule('water')
molecule.view()

Then I get this error:

Traceback (most recent call last):
File "C:\Users\BIOCHEM\Desktop\mmtk\mmtk_water.py", line 4, in <module>
molecule.view()
File "C:\Python25\Lib\site-packages\MMTK\Collections.py", line 495, in view
Visualization.viewConfiguration(self, configuration, format)
File "C:\Python25\Lib\site-packages\MMTK\Visualization.py", line 263, in viewConfiguration
function(*args, **kwargs)
File "C:\Python25\Lib\site-packages\MMTK\Visualization.py", line 236, in genericViewConfiguration
import win32api
ImportError: No module named win32api

After searching for some answers on the internet (mainly this one: http://www.varioustopics.com/python/142947-importerror-no-module-named-win32api.html), I came to the conclusion that this is a problem in the path environment variables. Unfortunately, the answer to this question doesn't present details. And I need a detailed answer. This issue of the environment variables seems so simple to me as the mystery of life's emergence on Earth. I know how to change it, but I don't know what to change or when change it. Reading the Wikipedia articles on the subject didn't help me too much. So what I'd like to know is: how exactly to modify the system variable in this case? I must add a new variable or just one more path to an existing variable? What is the path to win32api (it should not be C:\Windows\System32)?

This is my current variable value:

Variable's name: Path

Variables's value:

C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;%PYTHON_HOME%;%PYTHON_HOME%\Scripts;C:\Program Files (x86);C:\Python27\; C:\Python27\Scripts;C:\Python25\DLLs

I also have this Python variable: PYTHON_HOME with this variable's value: C:\Python27

This question may seem trivial to an experienced programmer. But the answer to it can be very useful to others. There is a large number of biologists, biochemists and pharmacists interested in using computational methods to their problems. These professionals do not always have a computer scientist in the vicinity (especially if they are in an underdeveloped country).

Overcoming this initial frustrating phase of bugs and installation problems can be crucial in the scientific career of many people. And the answer to this question will help them.

Thanks in advance. If this forum is not appropriate for questions of this level, please give me a feedback.

like image 597
BioSimulator Avatar asked Oct 08 '22 03:10

BioSimulator


1 Answers

Install pywin32 or ActivePython.

like image 153
Ignacio Vazquez-Abrams Avatar answered Oct 13 '22 12:10

Ignacio Vazquez-Abrams