[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [modeller_usage] Python interpreter with Modeller 8v0



 wrote:
I'm trying to use basic python commands with modeller 8, but am finding the
commands are simply ignored.

Can you give an example? The commands shouldn't be 'simply ignored'; at worst, you should get a Python exception.

I'm mainly interested in using the 'import'
command so i can build a small library of functions for use with MODELLER
scripts, but the import command doesn't seem to be working for me - has anyone
tried it?

It should work, and in fact Modeller itself uses it on occasion (if you run 'mod8v0 -' you'll get a standard interactive Python prompt, and for convenience Modeller does an 'import readline' for you, which should work if you have a full Python installation).

Perhaps you don't have your module search path set correctly? See sections 6.1.1 and 6.2 in the Python tutorial at http://www.python.org/doc/2.3.5/tut/node8.html

Note that Modeller itself sets the PYTHONPATH environment variable so that it can read its own Python modules, so any value you set for PYTHONPATH will be ignored. In the next release it will simply append to PYTHONPATH, so that things will work exactly as they would for standalone Python. For the time being, if you write your own Python modules, you can either add to the search path by appending to sys.path before you do an import, or you can put the modules in the standard search path (usually /usr/lib/python2.3 for core Python, and ${MODINSTALL8v0}/modlib for Modeller).

If not, I'm wondering if it's possible to use a standard python
interpreter for say, linux, instead of the MODELLER interpreter.  Thanks!

The "MODELLER interpreter" _is_ the standard Python interpreter. On x86 Linux we just took the Python-2.3.4.tar.bz2 file from www.python.org, built it with "./configure --without-threads; make" and then linked the resultant libpython2.3.a in to the Modeller executable. On other platforms the procedure was similar (although on Mac OS X 10.3 Python is standard, so we dynamically link to the system Python library to enable us to use the standard modules, rather than linking it statically into the Modeller executable).

We link Python into Modeller, rather than providing Python modules to use with your favorite version of 'standard' Python, for two main reasons:

1. Packaging. This way, it 'just works' on all the platforms we support,
   even if you don't have Python installed, or have a version other than
   2.3.
2. At least on x86, dynamic libraries (.so files) are substantially
   slower than ordinary binaries, because they are position independent.
   Our benchmarks show a 15-25% performance degradation.

Obviously it would be nice to have Modeller just work as a 'standard' Python module (for one thing, this makes it much easier to integrate with other Python packages, such as Chimera, VMD, and PyMol) and this is a goal for future Modeller releases - but only once the two issues above have been resolved.

I hope this answers most questions people have about the Python interpreter in Modeller 8 - but feel free to ask additional questions (to the mailing list, please, not to me directly) if anything is still unclear.

	Ben Webb, Modeller Caretaker
--
             http://www.salilab.org/modeller/
Modeller mail list: http://salilab.org/mailman/listinfo/modeller_usage