2

I'm trying to run the biotech software pymol. It can't find the cmd.py module. However, it's in a directory, which is in the $PYTHONPATH.

[mzhKU_work] @ modules $ python launch_pymol.py 
Traceback (most recent call last):
  File "launch_pymol.py", line 32, in <module>
    import pymol
  File "/Users/mzhKU_work/software/pymol/modules/pymol/__init__.py", line 521, in <module>
    import pymol._cmd
ImportError: No module named _cmd

[mzhKU_work] @ modules $ ls ./pymol/
__init__.py          exporting.py         opengl
__init__.pyc         externing.py         parser.py
api.py               feedingback.py       parsing.py
callback.py          fitting.py           plugins
cgo.py               gui.py               povray.py
checking.py          gui.pyc              preset.py
cmd.py               headering.py         querying.py
cmd.pyc              helping.py           rpc.py
colorramping.py      importing.py         selecting.py
commanding.py        internal.py          selector.py
completing.py        invocation.py        setting.py
computing.py         invocation.pyc       shortcut.py
constants.py         keyboard.py          util.py
constants_palette.py keywords.py          vfont.py
contrib              locking.py           viewing.py
controlling.py       m4x.py               wizard
creating.py          menu.py              wizarding.py
editing.py           monitoring.py        xray.py
editor.py            morphing.py          xwin.py
embed                movie.py             xwin.pyc
experimenting.py     moving.py

[mzhKU_work] @ modules $ echo $PYTHONPATH
[...]/Users/mzhKU_work/software/pymol/modules:/Users/mzhKU_work/software/pymol/modules/pymol:/Users/[...]
[mzhKU_work] @ modules $ 

What could be the problem?

Vini.g.fer
  • 11,639
  • 16
  • 61
  • 90
TMOTTM
  • 3,286
  • 6
  • 32
  • 63
  • Can you open the `/Users/mzhKU_work/software/pymol/modules/pymol/` directory and check if _cmd.so` (or whatever the extension for native libraries is on your system, I'm guessing .so for Mac OS X) is in the directory? PyMol normally ships with `cmd.py` and `_cmd.so`, so renaming either file is not a good solution. – Alex Huszagh May 07 '16 at 23:23
  • Oh wait, the issue seems to be the lack of the `_cmd.so`. Where did you install PyMol from? Did you use Homebrew/MacPorts, the student version, or the another installer? – Alex Huszagh May 07 '16 at 23:29

1 Answers1

1

The module it is trying to import is _cmd, not cmd.

Your problem looks like a bug in the library, you could try to report it to the developers.

As a temporary solution, you could copy cmd.py to _cmd.py.

Valentin Lorentz
  • 9,556
  • 6
  • 47
  • 69
  • 1
    There isn't a bug in the library normally. Pymol ships normally with it's own executable except when using the OpenSource versions in package managers (such as Homebrew, aptitude, Yum, etc.), using the system Python isn't (always) the correct approach. Also, `_cmd` should be compiled as a native binary, and cmd.py should be provided as a Python executable. I think it's more so an issue with the native library (which is why it's not found). – Alex Huszagh May 07 '16 at 23:22