Help importing Avogadro module into python

Hi there,

I’m a new subscriber to the list. First I’d like to say I tried Avogadro
a year or so ago and since then it has become really polished. I
appreciate all the hard work that has been put into it.

I’m currently interested in coupling the molecule viewer and editing
into some code that I’m writing. I run Ubuntu 9.10 and compiled and
installed Avogadro 1.0 from the sourceforge files. Just to test things
out I go into python (2.6) and run

import Avogadro

just like the tutorial suggest, and python tells me that there is no
module installed. I’m assuming this is just an issue with my PYTHONPATH
environment variable not knowing where to look for the module, problem
is I don’t know where to look for it either! I’d love to get this
running. Can anyone help get me started. I’ve looked in all the obvious
places, like the directories that Avogadro gets installed into. In all
the tutorials it seems like “import Avogadro” just works. Also, I can’t
access the python terminal from inside the Avogadro gui program either.
There’s not “scripting” option in the menu bar or under
"Settings"->“Toolbar”. I have the BOOST-Python libraries installed and
there was no problem with cmake when I compiled the program.

Any suggestions?

Sincerely,
Joey


“The result of this experiment was inconclusive, so we had to use statistics.”
-(Overheard at international physics conference)


Yung-Jin Hu
Ph.D. Candidate, College of Chemistry
University of California, Berkeley

Lawrence Berkeley National Laboratory
Nuclear Science Division
One Cyclotron Road, MS 70A-1150
Berkeley, CA 94720-8101
(510) 486-5209


Hi,

On Mon, Mar 1, 2010 at 8:03 PM, Yung-Jin Hu YHu@lbl.gov wrote:

Hi there,

I’m a new subscriber to the list. First I’d like to say I tried Avogadro
a year or so ago and since then it has become really polished. I
appreciate all the hard work that has been put into it.

I’m currently interested in coupling the molecule viewer and editing
into some code that I’m writing. I run Ubuntu 9.10 and compiled and
installed Avogadro 1.0 from the sourceforge files. Just to test things
out I go into python (2.6) and run

import Avogadro

just like the tutorial suggest, and python tells me that there is no
module installed. I’m assuming this is just an issue with my PYTHONPATH
environment variable not knowing where to look for the module, problem
is I don’t know where to look for it either! I’d love to get this
running. Can anyone help get me started. I’ve looked in all the obvious
places, like the directories that Avogadro gets installed into. In all
the tutorials it seems like “import Avogadro” just works. Also, I can’t
access the python terminal from inside the Avogadro gui program either.
There’s not “scripting” option in the menu bar or under
"Settings"->“Toolbar”. I have the BOOST-Python libraries installed and
there was no problem with cmake when I compiled the program.

Any suggestions?

The most likely problem is that you do not have all python
dependencies. If you have all dependencies, the output when running
cmake should be like:


– [1/5] Boost Python
– Boost Python found…
– [2/5] Python Libraries
– Found PythonLibs: /usr/lib/libpython2.6.so
– [3/5] Python Interpreter
– Found PythonInterp: /usr/bin/python2.6
– [4/5] Numpy Module
– Numpy headers found
– [5/5] SIP Module
– Found sip.h header…
– using sip version 4.8 or above…
– All python dependencies found - Python support enabled

Not the last line. Only if you see the last line, you have all needed
dependencies. Here is the command to install all required packages:

sudo apt-get install libboost-python-dev python-numpy-dev sip4 (I hope
I didn’t forget one)

Most likely, you don’t have sip4 installed. Once you have all
dependencies and rebuild avogadro, “make install” moves the Avogadro
python module to the correct location. After this "import Avogadro"
should work.

If you want to find the directory containing the python modules, you
can always use this python script:

from sys import stdout
from distutils import sysconfig
stdout.write(sysconfig.get_python_lib())

Cheers,
Tim

Sincerely,
Joey


“The result of this experiment was inconclusive, so we had to use statistics.”
-(Overheard at international physics conference)


Yung-Jin Hu
Ph.D. Candidate, College of Chemistry
University of California, Berkeley

Lawrence Berkeley National Laboratory
Nuclear Science Division
One Cyclotron Road, MS 70A-1150
Berkeley, CA 94720-8101
(510) 486-5209



Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-discuss