From: Axel Kohlmeyer (
Date: Fri Jul 17 2009 - 08:22:13 CDT

On Fri, 2009-07-17 at 14:12 +0200, Michael Kreim wrote:
> Hello,

hello michael!

> I have some trouble setting my PYTHONPATH environmental variable in vmd
> 1.8.6.
> When I set:
> set env(PYTHONPATH) .

ouch!! setting a "path" to the current working directory
is almost always a bad idea. the behavior of programs will
be very inconsistent, depending where you choose your
current working directory.

> I always get this error:
> $ vmd -dispdev text -python
> Info) VMD for LINUXAMD64, version 1.8.6 (April 6, 2007)
> Info)
> Info) Email questions and bug reports to
> Info) Please include this reference in published work using VMD:
> Info) Humphrey, W., Dalke, A. and Schulten, K., `VMD - Visual
> Info) Molecular Dynamics', J. Molec. Graphics 1996, 14.1, 33-38.
> Info) -------------------------------------------------------------
> Info) Multithreading available, 4 CPUs detected.
> Info) Free system memory: 2290MB (58%)
> /home/mkreim/data/bin/python/python-2.2.3/
> .
> Info) Starting Python...
> Traceback (most recent call last):
> File "<string>", line 1, in ?
> ImportError: No module named VMD
> Info) Text interpreter now Python
> >>>
> But when I print my path using python (sys.path) the actual directory is
> included.
> If I don't set PYTHONPATH everything starts up without errors, but I
> cannot load own modules.

please note that PYTHONPATH is a "path", i.e. it may already contain
multiple entries, e.g. those added by VMD. if you plain set it, you
will delete all previous entries. so what you'd have to do is something
like this:

set env(PYTHONPATH) "$env(PYTHONPATH):[file normalize .]"

that will append your current directory in a canonical form
to and existing path. since VMD appends its own directories
to PYTHONPATH, you can rely on it being set from within .vmdrc.

> Unfortunately I did not find anything helpful regarding this problem. So
> maybe somebody can give me some hint?

this is not a VMD problem at all, so you may have looked in
the wrong place. i hope my suggestions help.


> Thanks in advance.
> With best regards,
> Michael

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.