
As Greg suggested, after setting the CHIMERA environment variable, "import chimeraInit" followed by "chimeraInit.init([])" works after I added CHIMERA/lib to LD_LIBRARY_PATH. Without setting the LD_LIBRARY_PATH, chimera.__init__.py wasn't able to find the shared object files. Now "import Midas" works in my non-chimera python installation (great!). So in conclusion, the following environment variables need to be configured (on my ubuntu system at least) where CHIMERA is the path to the chimera install: LD_LIBRARY_PATH=CHIMERA/lib PYTHONPATH=CHIMERA/share:CHIMERA/lib Thanks to Greg and Eric for getting back to me so quickly. Drew On Thu, Mar 5, 2009 at 3:10 PM, Greg Couch <gregc@cgl.ucsf.edu> wrote:
On Thu, 5 Mar 2009, Drew Bryant wrote:
Hello,
As part of a larger python-based project I'm working on, I need to do automated image generation with Chimera. How can the Midas module (no need for any gui components) be imported into a non-chimera installation of python? I think this is a little more complicated than just setting the PYTHONPATH to point at the chimera files, because of the compiled shared objects. For example, my attempt at importing Midas (after adding CHIMERA/share to the PYTHON PATH) raises:
/home/dbryant/CHIMERA/share/Midas/__init__.py in <module>()
/home/dbryant/CHIMERA/share/chimera/__init__.py in <module>()
<type 'exceptions.ImportError'>: libgfxinfo.so: cannot open shared object file: No such file or directory
Currently I'm using a non-gui daily build of Chimera for 64-bit Linux and calling the chimera binary via the shell (which works), but I need to be able to pass parameters to the script being run at the command line.
Thanks, Drew Bryant
To import chimera modules into a non-chimera installation of python, you need to set the CHIMERA environment variable and then import the chimeraInit module and call chimeraInit.init([]). In your case, you shouldn't need any keyword arguments to the init function, but if you were using the GUI version, then eventloop=False would very useful.
Good luck!
Greg Couch UCSF Computer Graphics Lab