OS X compilation problems, for Python bindings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

OS X compilation problems, for Python bindings

Rajarshi Guha-4
Thanks to Noel, I've got the Python bindings compiled, but it seems
that importing the openbabel package in Python is not working.

On doing make install eevrything seems to go OK, but I get warnings as
shown in http://gist.github.com/557363

and when I try to import the package I get

Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openbabel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.5/site-packages/openbabel.py", line 14, in <module>
    import _openbabel
ImportError: dlopen(/Library/Python/2.5/site-packages/_openbabel.so,
2): Library not loaded: /usr/local/lib/libopenbabel.3.dylib
  Referenced from: /Library/Python/2.5/site-packages/_openbabel.so
  Reason: image not found

I now realize that Openbabel is using Python 2.6 which I have in
addition to 2.5. Is there a way I can force it to compile with 2.5?

Thanks

--
Rajarshi Guha
NIH Chemical Genomics Center

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OS X compilation problems, for Python bindings

Noel O'Boyle
Administrator
Hi,

It is a (dumb) feature of cmake's FindPython that it choose the
highest version of Python it can find on your computer, instead of
using the first one on the path, which leads to these types of
problems.

If you "grep -i python CMakeCache.txt", you'll see a number of
variables associated with python, e.g. PYTHON_EXECUTABLE,
PYTHON_INCLUDE_PATH, PYTHON_LIBRARY. You can set these at the
command-line with -Dvariable_name=value.

Doublecheck the values in CMakeCache.txt, because CMake likes to do
things like use the python executable of one version, but the python
library of another version (!).

I'll add some text to the docs to handle this.

- Noel

On 30 August 2010 13:59, Rajarshi Guha <[hidden email]> wrote:

> Thanks to Noel, I've got the Python bindings compiled, but it seems
> that importing the openbabel package in Python is not working.
>
> On doing make install eevrything seems to go OK, but I get warnings as
> shown in http://gist.github.com/557363
>
> and when I try to import the package I get
>
> Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import openbabel
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/Library/Python/2.5/site-packages/openbabel.py", line 14, in <module>
>    import _openbabel
> ImportError: dlopen(/Library/Python/2.5/site-packages/_openbabel.so,
> 2): Library not loaded: /usr/local/lib/libopenbabel.3.dylib
>  Referenced from: /Library/Python/2.5/site-packages/_openbabel.so
>  Reason: image not found
>
> I now realize that Openbabel is using Python 2.6 which I have in
> addition to 2.5. Is there a way I can force it to compile with 2.5?
>
> Thanks
>
> --
> Rajarshi Guha
> NIH Chemical Genomics Center
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OS X compilation problems, for Python bindings

Rajarshi Guha-4
On Mon, Aug 30, 2010 at 9:20 AM, Noel O'Boyle <[hidden email]> wrote:

> Hi,
>
> It is a (dumb) feature of cmake's FindPython that it choose the
> highest version of Python it can find on your computer, instead of
> using the first one on the path, which leads to these types of
> problems.
>
> If you "grep -i python CMakeCache.txt", you'll see a number of
> variables associated with python, e.g. PYTHON_EXECUTABLE,
> PYTHON_INCLUDE_PATH, PYTHON_LIBRARY. You can set these at the
> command-line with -Dvariable_name=value.

Thanks, that fixed it. But when I try to import openbabel in Python I still get

>>> import openbabel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.5/site-packages/openbabel.py", line 14, in <module>
    import _openbabel
ImportError: dlopen(/Library/Python/2.5/site-packages/_openbabel.so,
2): Library not loaded: /usr/local/lib/libopenbabel.3.dylib
  Referenced from: /Library/Python/2.5/site-packages/_openbabel.so
  Reason: image not found

It turns out that I have v4 of the dylibs

guhar@office:~/src/openbabel $ find /usr/local -name "libopenbabel*"
/usr/local/openbabel/lib/libopenbabel.4.0.0.dylib
/usr/local/openbabel/lib/libopenbabel.4.dylib
/usr/local/openbabel/lib/libopenbabel.dylib

generating a symlink to satisfy the error doesn't help - I get a
missing symbol error

Maybe something needs to be updated somewhere?
--
Rajarshi Guha
NIH Chemical Genomics Center

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OS X compilation problems, for Python bindings

Geoffrey Hutchison
> It turns out that I have v4 of the dylibs

Do you have Open Babel installed anywhere else? You mentioned MacPorts. Did you install OB at any point using MacPorts? I'd check /opt for a "v3" dylib. Something is picking that up.

Hope that helps,
-Geoff
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OS X compilation problems, for Python bindings

Rajarshi Guha-4
Thanks for the pointer, that seemed to work. It's working now (thouhg
I still had to manually copy the Python package from
/usr/local/openbabel/lib/python2.5/site-packages/ to my system wide
location).

But on running a small script that goes through a SMILES file I got a
bus error. here's the report:

Process:         Python [54607]
Path:
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [38238]

Interval Since Last Report:          1452199 sec
Crashes Since Last Report:           39
Per-App Interval Since Last Report:  0 sec
Per-App Crashes Since Last Report:   1

Date/Time:       2010-08-30 13:00:53.730 -0400
OS Version:      Mac OS X 10.5.8 (9L31a)
Report Version:  6
Anonymous UUID:  A2D98871-6D26-4F54-8678-AD4490B75C0A

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0   smilesformat.so               0x02094f66
OpenBabel::SMIBaseFormat::ReadMolecule(OpenBabel::OBBase*,
OpenBabel::OBConversion*) + 1142 (smilesformat.cpp:277)
1   libopenbabel.4.dylib           0x00529269
OpenBabel::OBConversion::Read(OpenBabel::OBBase*,
std::basic_istream<char, std::char_traits<char> >*) + 217
(obconversion.cpp:773)
2   libopenbabel.4.dylib           0x005295c3
OpenBabel::OBConversion::ReadFile(OpenBabel::OBBase*,
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>) + 403 (obconversion.cpp:979)
3   _openbabel.so                 0x010d132b
_wrap_OBConversion_ReadFile + 859 (openbabel-python.cpp:18106)
4   org.python.python             0x00121505 PyObject_Call + 50
5   org.python.python             0x0018f832 PyEval_EvalFrameEx + 17904
6   org.python.python             0x00132960 _PyExc_Fini + 1438
7   org.python.python             0x0018ee23 PyEval_EvalFrameEx + 15329
8   org.python.python             0x00191173 PyEval_EvalCodeEx + 1638
9   org.python.python             0x00191260 PyEval_EvalCode + 87
10  org.python.python             0x001a883c PyErr_Display + 1896
11  org.python.python             0x001a8e66 PyRun_FileExFlags + 135
12  org.python.python             0x001aa7d2 PyRun_SimpleFileExFlags + 421
13  org.python.python             0x001b5a57 Py_Main + 3095
14  org.python.pythonapp           0x00001fca 0x1000 + 4042

Thread 1:
0   libSystem.B.dylib             0x921da6fa select$DARWIN_EXTSN + 10
1   libSystem.B.dylib             0x921bc155 _pthread_start + 321
2   libSystem.B.dylib             0x921bc012 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0xbfffe1dc  ebx: 0x02094b04  ecx: 0x00328c9c  edx: 0x00000000
  edi: 0xbfffe1e6  esi: 0x00328c90  ebp: 0xbfffe208  esp: 0xbfff5ff0
   ss: 0x0000001f  efl: 0x00010282  eip: 0x02094f66   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x00000000

<snip>


On Mon, Aug 30, 2010 at 12:49 PM, Geoffrey Hutchison
<[hidden email]> wrote:
>> It turns out that I have v4 of the dylibs
>
> Do you have Open Babel installed anywhere else? You mentioned MacPorts. Did you install OB at any point using MacPorts? I'd check /opt for a "v3" dylib. Something is picking that up.
>
> Hope that helps,
> -Geoff



--
Rajarshi Guha
NIH Chemical Genomics Center

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OS X compilation problems, for Python bindings

Rajarshi Guha-4
An example SMILES is

Ic1cc(cc(I)c1Oc1cc(I)c(O)cc1)CC([NH3+])C(=O)[O-] 11532858

and the code that fails is

import pybel

from openbabel import *
import sys

for mol in pybel.readfile("smi", sys.argv[1]):
    atoms = [x for x in mol]
    nsp3 = len(filter(lambda x: x.atomicnum == 6 and x.hyb == 3, atoms))
    nsp2 = len(filter(lambda x: x.atomicnum == 6 and x.hyb == 2, atoms))
    ratio = nsp3/float(nsp2+nsp3)
    print mol.title, ratio

On Mon, Aug 30, 2010 at 1:04 PM, Rajarshi Guha <[hidden email]> wrote:

> Thanks for the pointer, that seemed to work. It's working now (thouhg
> I still had to manually copy the Python package from
> /usr/local/openbabel/lib/python2.5/site-packages/ to my system wide
> location).
>
> But on running a small script that goes through a SMILES file I got a
> bus error. here's the report:
>
> Process:         Python [54607]
> Path:
> /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
> Identifier:      Python
> Version:         ??? (???)
> Code Type:       X86 (Native)
> Parent Process:  bash [38238]
>
> Interval Since Last Report:          1452199 sec
> Crashes Since Last Report:           39
> Per-App Interval Since Last Report:  0 sec
> Per-App Crashes Since Last Report:   1
>
> Date/Time:       2010-08-30 13:00:53.730 -0400
> OS Version:      Mac OS X 10.5.8 (9L31a)
> Report Version:  6
> Anonymous UUID:  A2D98871-6D26-4F54-8678-AD4490B75C0A
>
> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
> Crashed Thread:  0
>
> Thread 0 Crashed:
> 0   smilesformat.so                     0x02094f66
> OpenBabel::SMIBaseFormat::ReadMolecule(OpenBabel::OBBase*,
> OpenBabel::OBConversion*) + 1142 (smilesformat.cpp:277)
> 1   libopenbabel.4.dylib                0x00529269
> OpenBabel::OBConversion::Read(OpenBabel::OBBase*,
> std::basic_istream<char, std::char_traits<char> >*) + 217
> (obconversion.cpp:773)
> 2   libopenbabel.4.dylib                0x005295c3
> OpenBabel::OBConversion::ReadFile(OpenBabel::OBBase*,
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>) + 403 (obconversion.cpp:979)
> 3   _openbabel.so                       0x010d132b
> _wrap_OBConversion_ReadFile + 859 (openbabel-python.cpp:18106)
> 4   org.python.python                   0x00121505 PyObject_Call + 50
> 5   org.python.python                   0x0018f832 PyEval_EvalFrameEx + 17904
> 6   org.python.python                   0x00132960 _PyExc_Fini + 1438
> 7   org.python.python                   0x0018ee23 PyEval_EvalFrameEx + 15329
> 8   org.python.python                   0x00191173 PyEval_EvalCodeEx + 1638
> 9   org.python.python                   0x00191260 PyEval_EvalCode + 87
> 10  org.python.python                   0x001a883c PyErr_Display + 1896
> 11  org.python.python                   0x001a8e66 PyRun_FileExFlags + 135
> 12  org.python.python                   0x001aa7d2 PyRun_SimpleFileExFlags + 421
> 13  org.python.python                   0x001b5a57 Py_Main + 3095
> 14  org.python.pythonapp                0x00001fca 0x1000 + 4042
>
> Thread 1:
> 0   libSystem.B.dylib                   0x921da6fa select$DARWIN_EXTSN + 10
> 1   libSystem.B.dylib                   0x921bc155 _pthread_start + 321
> 2   libSystem.B.dylib                   0x921bc012 thread_start + 34
>
> Thread 0 crashed with X86 Thread State (32-bit):
>  eax: 0xbfffe1dc  ebx: 0x02094b04  ecx: 0x00328c9c  edx: 0x00000000
>  edi: 0xbfffe1e6  esi: 0x00328c90  ebp: 0xbfffe208  esp: 0xbfff5ff0
>   ss: 0x0000001f  efl: 0x00010282  eip: 0x02094f66   cs: 0x00000017
>   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
>  cr2: 0x00000000
>
> <snip>
>
>
> On Mon, Aug 30, 2010 at 12:49 PM, Geoffrey Hutchison
> <[hidden email]> wrote:
>>> It turns out that I have v4 of the dylibs
>>
>> Do you have Open Babel installed anywhere else? You mentioned MacPorts. Did you install OB at any point using MacPorts? I'd check /opt for a "v3" dylib. Something is picking that up.
>>
>> Hope that helps,
>> -Geoff
>
>
>
> --
> Rajarshi Guha
> NIH Chemical Genomics Center
>



--
Rajarshi Guha
NIH Chemical Genomics Center

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: OS X compilation problems, for Python bindings

Noel O'Boyle
Administrator
In reply to this post by Rajarshi Guha-4
Hi,

It's not clear from your email whether it is a problem with a
particular SMILES (i.e. a bug) or all SMILES (i.e. install problem).
Can you clarify?

Regarding manual copying of Python packages, you should add the
install directory to your PYTHONPATH instead (and maybe complain to
MacPorts that they should do this). We install to the location that
MacPorts has configured distutils to use (which is typically different
than where MacPorts would install it's own Python packages).

- Noel

On 30 August 2010 18:04, Rajarshi Guha <[hidden email]> wrote:

> Thanks for the pointer, that seemed to work. It's working now (thouhg
> I still had to manually copy the Python package from
> /usr/local/openbabel/lib/python2.5/site-packages/ to my system wide
> location).
>
> But on running a small script that goes through a SMILES file I got a
> bus error. here's the report:
>
> Process:         Python [54607]
> Path:
> /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
> Identifier:      Python
> Version:         ??? (???)
> Code Type:       X86 (Native)
> Parent Process:  bash [38238]
>
> Interval Since Last Report:          1452199 sec
> Crashes Since Last Report:           39
> Per-App Interval Since Last Report:  0 sec
> Per-App Crashes Since Last Report:   1
>
> Date/Time:       2010-08-30 13:00:53.730 -0400
> OS Version:      Mac OS X 10.5.8 (9L31a)
> Report Version:  6
> Anonymous UUID:  A2D98871-6D26-4F54-8678-AD4490B75C0A
>
> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
> Crashed Thread:  0
>
> Thread 0 Crashed:
> 0   smilesformat.so                     0x02094f66
> OpenBabel::SMIBaseFormat::ReadMolecule(OpenBabel::OBBase*,
> OpenBabel::OBConversion*) + 1142 (smilesformat.cpp:277)
> 1   libopenbabel.4.dylib                0x00529269
> OpenBabel::OBConversion::Read(OpenBabel::OBBase*,
> std::basic_istream<char, std::char_traits<char> >*) + 217
> (obconversion.cpp:773)
> 2   libopenbabel.4.dylib                0x005295c3
> OpenBabel::OBConversion::ReadFile(OpenBabel::OBBase*,
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>) + 403 (obconversion.cpp:979)
> 3   _openbabel.so                       0x010d132b
> _wrap_OBConversion_ReadFile + 859 (openbabel-python.cpp:18106)
> 4   org.python.python                   0x00121505 PyObject_Call + 50
> 5   org.python.python                   0x0018f832 PyEval_EvalFrameEx + 17904
> 6   org.python.python                   0x00132960 _PyExc_Fini + 1438
> 7   org.python.python                   0x0018ee23 PyEval_EvalFrameEx + 15329
> 8   org.python.python                   0x00191173 PyEval_EvalCodeEx + 1638
> 9   org.python.python                   0x00191260 PyEval_EvalCode + 87
> 10  org.python.python                   0x001a883c PyErr_Display + 1896
> 11  org.python.python                   0x001a8e66 PyRun_FileExFlags + 135
> 12  org.python.python                   0x001aa7d2 PyRun_SimpleFileExFlags + 421
> 13  org.python.python                   0x001b5a57 Py_Main + 3095
> 14  org.python.pythonapp                0x00001fca 0x1000 + 4042
>
> Thread 1:
> 0   libSystem.B.dylib                   0x921da6fa select$DARWIN_EXTSN + 10
> 1   libSystem.B.dylib                   0x921bc155 _pthread_start + 321
> 2   libSystem.B.dylib                   0x921bc012 thread_start + 34
>
> Thread 0 crashed with X86 Thread State (32-bit):
>  eax: 0xbfffe1dc  ebx: 0x02094b04  ecx: 0x00328c9c  edx: 0x00000000
>  edi: 0xbfffe1e6  esi: 0x00328c90  ebp: 0xbfffe208  esp: 0xbfff5ff0
>   ss: 0x0000001f  efl: 0x00010282  eip: 0x02094f66   cs: 0x00000017
>   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
>  cr2: 0x00000000
>
> <snip>
>
>
> On Mon, Aug 30, 2010 at 12:49 PM, Geoffrey Hutchison
> <[hidden email]> wrote:
>>> It turns out that I have v4 of the dylibs
>>
>> Do you have Open Babel installed anywhere else? You mentioned MacPorts. Did you install OB at any point using MacPorts? I'd check /opt for a "v3" dylib. Something is picking that up.
>>
>> Hope that helps,
>> -Geoff
>
>
>
> --
> Rajarshi Guha
> NIH Chemical Genomics Center
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss