Pybel on Mac OS X

I just tried to install openbabel and its python wrapper pybel on a Mac running OS X 10.4. OpenBabel compiled fine from source, no problems with that. But when I tried to run python setup.py build in the scripts/python subdirectory, the build failed at the linking stage with

/usr/bin/ld: for architecture ppc
/usr/bin/ld: can't locate file for: -lopenbabel
collect2: ld returned 1 exit status

The solution turned out to be that—at least for my computer—I needed to set the environment variable OPENBABEL_INSTALL to /usr/local explicitly. Normally, the library is looked for in the src directory, i.e., where openbabel was built, but that didn’t work, for whatever reason (I haven’t checked up on that).

After setting the appropriate environment variable with export OPENBABEL_INSTALL=/usr/local everything works fine, the install as root finished without any problems, and everything works:

host:~/models/ flo$ python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import pybel
>>>

Tags: , ,

3 Responses to “Pybel on Mac OS X”

  1. baoilleach Says:

    What version were you trying to install? The latest snapshot?

  2. admin Says:

    Yes, it was the latest stable release, i.e. 2.1.1.

  3. baoilleach Says:

    If you have the same problem with the latest beta release (which includes some changes to setup.py), I’d be interested to see the output of “ls -alR” in the openbabel directory.

Leave a Reply