simtk.openmm import error

Permit researchers and python developers access to the OpenMM libraries.
POST REPLY
User avatar
Siddharth Srinivasan
Posts: 223
Joined: Thu Feb 12, 2009 6:49 pm

simtk.openmm import error

Post by Siddharth Srinivasan » Fri Jun 17, 2011 1:38 pm

I installed OpenMM3.0 from source, and enabled the OPENMM_PYTHON_WRAPPER option in the config file, which I assume is PyOpenMM. I followed the instructions from the OpenMM user manual in the Python section.
1. I installed OpenMM with Python wrapper support
2. I the cd-ed to the "python" directory, and successfully ran "python setup.py build" and "python setup.py install" with a bit of PYTHONPATH juggling.

I can now "import simtk" in the python interpreter, but as soon as I do "import simtk.openmm" I get the error
{{{
siddharth@node081 ~/Downloads/OpenMM3.0-Source/src/install/python $ bpython
>>> import simtk
>>> import simtk.openmm
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "simtk/openmm/__init__.py", line 36, in <module>
from simtk.openmm.openmm import *
File "simtk/openmm/openmm.py", line 37, in <module>
_openmm = swig_import_helper()
File "simtk/openmm/openmm.py", line 29, in swig_import_helper
import _openmm
ImportError: No module named _openmm
}}}
Any ideas? I think I have the PYTHONPATH set correctly, it points to the location where I installed the python library, i,e
{{{
$ echo $PYTHONPATH
$OPENMM_SRC/src/install/python/install/lib64/python2.6/site-packages/
}}}

User avatar
Siddharth Srinivasan
Posts: 223
Joined: Thu Feb 12, 2009 6:49 pm

RE: simtk.openmm import error

Post by Siddharth Srinivasan » Fri Jun 17, 2011 1:40 pm

I should also say, if I try and re-install the python library again, I get a very Pythonic error of the form
{{{
siddharth@node081 ~/Downloads/OpenMM3.0-Source/src/install/python $ python setup.py install --prefix=/Network/Cluster/home/siddharth/Downloads/OpenMM3.0-Source/src/install/python/install
Traceback (most recent call last):
File "setup.py", line 181, in <module>
main()
File "setup.py", line 176, in main
uninstall()
File "setup.py", line 54, in uninstall
import simtk.openmm as openmm
File "/Network/Cluster/home/siddharth/Downloads/OpenMM3.0-Source/src/install/python/install/lib64/python2.6/site-packages/simtk/openmm/__init__.py", line 36, in <module>
from simtk.openmm.openmm import *
File "/Network/Cluster/home/siddharth/Downloads/OpenMM3.0-Source/src/install/python/install/lib64/python2.6/site-packages/simtk/openmm/openmm.py", line 37, in <module>
_openmm = swig_import_helper()
File "/Network/Cluster/home/siddharth/Downloads/OpenMM3.0-Source/src/install/python/install/lib64/python2.6/site-packages/simtk/openmm/openmm.py", line 36, in swig_import_helper
return _mod
UnboundLocalError: local variable '_mod' referenced before assignment
}}}

User avatar
Siddharth Srinivasan
Posts: 223
Joined: Thu Feb 12, 2009 6:49 pm

RE: simtk.openmm import error

Post by Siddharth Srinivasan » Fri Jun 17, 2011 3:11 pm

Ah I figured it out, I was in the wrong source directory. I can now do
{{{
import simtk
import simtk.openmm
import simtk.unit
}}}
but when I try a trivial example from the OpenMM user manual, I get the following error
{{{
>>> import simtk.openmm as mm
>>> a=mm.System()
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'System'
>>> import simtk.openmm.openmm as mm
>>> a=mm.System()
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'System'
}}}

POST REPLY