From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Fri Oct 10 2008 - 11:37:28 CDT

On Thu, 9 Oct 2008, Ryan Pavlovicz wrote:

RP> Thanks for the response, Axel.

ryan,

RP> I am running VMD for LINUXAMD64, version 1.8.6. My AMD x86_64 workstation
RP> is running SUSE 10.1 Linux.
RP> What do you mean by installing the "matching" python installation.

something that matches what VMD was compiled with.

RP> I am running python 2.5.1 and 2.5.2 on my machine, not v 2.2, so is the main
RP> problem? Should the higher versions of python not be back-compatible? Or

they may be backward compatible on the script level, but not on the
binary level. but what you are looking for is actually _forward_
compatibility (you want to incorporate a v2.5 library into a v2.2
interpreter). this is a no-go. the situation gets more complicated
by the fact that some python modules come with binary components,
e.g. numpy and tkinter. particularly tkinter is creating a real mess,
as it in turn wraps the Tk library into python. now VMD already is
linked to Tk, but you have to make sure that you have the same Tk
and the same python and all modules with all kinds of dependencies
in the same version.

this is the biggest weaknesses of python, in my opinion. it is very
flexible and allows interfacing to many facilities and libraries in
a simple way, so you'd end up with minimal scripting and lots of
convenience. but exactly because of all those modules and the
flexibility, you end up with almost uncontrollable dependency
problems for any application that goes beyond minimal scripting
or depends on a specific python interpreter or specific modules.
there you are basically forced to install a complete separate python
environment, to avoid all kinds of side-effects and incompatibilities.
i've just seen this on our web server with a python based CMS.

RP> can i compile VMD to work with my system python (2.5)? If so, how? Thanks

it will require some work with the current release source code.
but since john has updated his build environment to use python 2.5,
it should work with the current alpha versions (or the cvs code).

you may actually get lucky and could get an alpha version build
work with your system python installation.

as for compiling against the system libraries. it works fine for
both, python and tcl/tk and i'm doing it myself. the easiest way
to make it work is to emulate the expected build environment.
i've written some comments on that in the public VMD biocore project
Lab book (on building native rpms) and posted corresponding .spec
files that have the necessary scripting integrated.

it requires some knowledge of unix scripting and compiling, but
people here (or on the VMD biocore chat) are generally willing to
help out in case you get stuck.

cheers,
   axel.

RP> again,
RP>
RP> -ryan
RP>
RP> On Thu, Oct 9, 2008 at 5:31 PM, Axel Kohlmeyer
RP> <akohlmey_at_cmm.chem.upenn.edu>wrote:
RP>
RP> > On Thu, 9 Oct 2008, Ryan Pavlovicz wrote:
RP> >
RP> > ryan,
RP> >
RP> > RP> Hi. I am having trouble loading python in VMD and am wondering if
RP> > someone
RP> > RP> can help me out.
RP> >
RP> > not as such. vital pieces of information are missing:
RP> > - what version of VMD do you use?
RP> > - what operating system do you use?
RP> > - have you installed the "matching" python installation.
RP> > VMD does usually not work with the system python.
RP> >
RP> >
RP> > RP> When executing VMD from the command line with:
RP> > RP>
RP> > RP> >VMD -python
RP> > RP>
RP> > RP> Python will load, but with the following error messages:
RP> > RP>
RP> > RP> 'import site' failed; use -v for traceback
RP> > RP> Could not find Numeric Python version >= 22.0
RP> > RP> ImportError: No module named numeric_version
RP> > RP> Info) Text interpreter now Python
RP> > RP> Traceback (most recent call last):
RP> > RP> File "<string>", line 1, in ?
RP> > RP> File "/usr/local/lib/vmd/scripts/python/Tkinter.py", line 62, in ?
RP> > RP> from types import *
RP> > RP> ImportError: No module named types
RP> > RP>
RP> > RP> from there i can import VMD without any problems, but cannot import
RP> > other
RP> > RP> modules such as numpy or fileinput.
RP> > RP>
RP> > RP> If i exit out of this python session, then type 'python' in the vmd
RP> > console,
RP> > RP> VMD loads cleanly, however i cannot import the VMD module.
RP> > RP>
RP> > RP> vmd >python
RP> >
RP> > please note, that this will start the general system
RP> > python interpreter as a subprocess and will halt VMD until
RP> > you return from it. to get access to the embedded python
RP> > interpreter you have to type "gopython" (see the VMD documentation).
RP> >
RP> > RP> Python 2.5.1 (r251:54863, Sept 25 2007, 17:59:18)
RP> > RP> [GCC 4.1.0 (SUSE Linux)] on linux2
RP> > RP> >>> import VMD
RP> > RP> Traceback (most recent call last):
RP> > RP> File "<stdin>", line 1, in <module>
RP> > RP> File "/usr/local/lib/vmd/scripts/python/VMD.py", line 27, in <module>
RP> > RP> import animate
RP> > RP> ImportError: No module name animate
RP> >
RP> > this is a different issue. i am not certain, whether actually
RP> > importing VMD's python module into a system python interpreter
RP> > is completely working. if at all that probably only for the
RP> > latest beta versions. nevertheless, your python interpreter
RP> > has to be compatible with the one used to compile VMD and that
RP> > is usually not the case. only the very latest test versions of
RP> > VMD use python 2.5 for example...
RP> >
RP> > to make VMD compatible with the system python installation, you
RP> > will have to compile VMD from source and adjust the VMD build
RP> > scripts accordingly.
RP> >
RP> > cheers,
RP> > axel.
RP> >
RP> > RP>
RP> > RP> Any suggestions on how to get python working with VMD cleanly? Thanks
RP> > in
RP> > RP> advance,
RP> > RP>
RP> > RP> ryan
RP> > RP>
RP> >
RP> > --
RP> > =======================================================================
RP> > Axel Kohlmeyer akohlmey_at_cmm.chem.upenn.edu http://www.cmm.upenn.edu
RP> > Center for Molecular Modeling -- University of Pennsylvania
RP> > Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
RP> > tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425
RP> > =======================================================================
RP> > If you make something idiot-proof, the universe creates a better idiot.
RP> >
RP>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   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.