[chimera-dev] adding python packages to chimera environment

Darren Weber dweber at cgl.ucsf.edu
Fri Aug 20 13:25:02 PDT 2010

This an example of getting some packages installed into the Chimera 
python environment.  In my case, I was interested in using the spyder 
IDE within the Chimera python installation.


First, get the setuptools (easy_install) package:

$ sudo -i
# export PATH=$PATH:/opt/UCSF/Chimera64-2010-08-05/bin/
# export LD_LIBRARY_PATH=/opt/UCSF/Chimera64-2010-08-05/lib
# sh /home/dweber/Downloads/setuptools-0.6c11-py2.7.egg 

That gets 'easy_install' working with the Chimera python installation.

Now for the spyder IDE.  It requires PyQt4, so it's not trivial, but the 
following seems to build and install OK (against an Ubuntu package 
install for Qt4, not a custom build of Qt4 in foreign; the wget commands 
fetch linux-specific downloads):

$ sudo -i
# wget 
# tar zxvf sip-4.10.5.tar.gz
# cd sip-4.10.5
# /opt/UCSF/Chimera64-2010-08-05/bin/python2.7 configure.py
# make
# make install
# cd ..
# wget 
# tar zxvf PyQt-x11-gpl-4.7.4.tar.gz
# cd PyQt-x11-gpl-4.7.4
# update-alternatives --config qmake  #select qmake-qt4 option
# /opt/UCSF/Chimera64-2010-08-05/bin/python2.7 configure.py 
--no-designer-plugin --qmake=/usr/bin/qmake-qt4
The PyQt Python package will be installed in
PyQt is being built with generated docstrings.
PyQt is being built with 'protected' redefined as 'public'.
The PyQt .sip files will be installed in
pyuic4, pyrcc4 and pylupdate4 will be installed in
#make install

That should satisfy the deps for spyder.  Then use easy_install to get 
spyder installed, like so:

# /opt/UCSF/Chimera64-2010-08-05/bin/easy_install spyder

Then to run spyder with a chimera-like env, the following seems to work:

# export CHIMERA=/opt/UCSF/Chimera64-2010-08-05
# export LD_LIBRARY_PATH="$CHIMERA/lib/"
# export TCL_LIBRARY="$CHIMERA/lib/tcl8.6"
# export TCLLIBPATH="{$CHIMERA/lib}"
# unset TK_LIBRARY
# export LD_PRELOAD=libotf.so
# export PATH=$PATH:$CHIMERA/bin
# $CHIMERA/bin/spyder

Within the spyder interactive console, it reports running python 2.7 and 
I see:

 >>> import sys
 >>> sys.path
['', '/opt/UCSF/Chimera64-2010-08-05/bin', 

This is not quite the right path (and maybe LD_LIBRARY_PATH etc.), but a 
few tweaks get it working, i.e.:

 >>> sys.path.append('/opt/UCSF/Chimera64-2010-08-05/share')
 >>> sys.path.append('/opt/UCSF/Chimera64-2010-08-05/lib')
 >>> import chimera
 >>> chimera.version.version
'alpha version 1.5 (build 31152) 2010-08-05 19:55:24 GMT'

This may not be a complete config/setup, but it's close.  The spyder 
interface provides autocompletion, auto help-inspection, debug 
facilities, workspace, etc.

If anyone finds a better way to do this, please let me know.  There may 
be better ways to do this with virtualenv, see



Darren L. Weber, Ph.D.
Programmer/Analyst on Chimera Development Team
Resource for Biocomputing, Visualization, and Informatics
Department of Pharmaceutical Chemistry
University of California, San Francisco
Mission Bay Campus (MC 2240), Genentech Hall (Room N453)
600 16th Street, San Francisco, CA 94158-2517
dweber[at]cgl.ucsf.edu, 415-439-0619 (google voice)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20100820/28fe4aeb/attachment.html>

More information about the Chimera-dev mailing list