help - segmentation fault with Pybel on Mac OS x

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

help - segmentation fault with Pybel on Mac OS x

Hassan Thomas Mamdani
Hi

I have managed to compile OpenBabel with the python bindings on my Mac by following the instructions on the OpenBabel website.  OpenBabel works fine form the command line, and I can import pybel into python.  However whenever I try to use pybel I get a segmentation error  For example:

>> import pybel
>> mol = pybel.readstring('smi', 'cccccc')

Gives

Process:         Python [828]
Path:            /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  bash [788]

PlugIn Path:       /usr/local/lib/openbabel/2.3.0/smilesformat.so
PlugIn Identifier: smilesformat.so
PlugIn Version:    ??? (???)

Date/Time:       2011-02-27 17:54:20.545 +0000
OS Version:      Mac OS X 10.6.6 (10J567)
Report Version:  6

Interval Since Last Report:          55803 sec
Crashes Since Last Report:           9
Per-App Crashes Since Last Report:   8
Anonymous UUID:                      2F0E7AD2-6BEA-4699-94B9-3084B1D5402C

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000090
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   smilesformat.so               0x0000000102a23833 OpenBabel::SMIBaseFormat::ReadMolecule(OpenBabel::OBBase*, OpenBabel::OBConversion*) + 1011 (mol.h:355)
1   libopenbabel.4.dylib           0x00000001014e51ec OpenBabel::OBConversion::Read(OpenBabel::OBBase*, std::istream*) + 220 (obconversion.cpp:789)
2   libopenbabel.4.dylib           0x00000001014ea49c OpenBabel::OBConversion::ReadString(OpenBabel::OBBase*, std::string) + 508 (obconversion.cpp:937)
3   _openbabel.so                 0x0000000101181d36 _wrap_OBConversion_ReadString + 262 (openbabel-python.cpp:18172)
4   org.python.python             0x000000010000aff3 PyObject_Call + 112
5   org.python.python             0x000000010008a51a PyEval_EvalFrameEx + 20328
6   org.python.python             0x00000001000892e1 PyEval_EvalFrameEx + 15663
7   org.python.python             0x000000010008acce PyEval_EvalCodeEx + 1803
8   org.python.python             0x000000010008ad61 PyEval_EvalCode + 54
9   org.python.python             0x00000001000a265a Py_CompileString + 78
10  org.python.python             0x00000001000a44dd PyRun_InteractiveOneFlags + 503
11  org.python.python             0x00000001000a4615 PyRun_InteractiveLoopFlags + 206
12  org.python.python             0x00000001000a4685 PyRun_AnyFileExFlags + 76
13  org.python.python             0x00000001000b0286 Py_Main + 2718
14  org.python.python.app         0x0000000100000e6c start + 52

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0xffffffffffffffff  rbx: 0xffffffffffffffff  rcx: 0x0000000000000063  rdx: 0x0000000000000000
  rdi: 0x0000000102a2cb0b  rsi: 0x0000000000000063  rbp: 0x00007fff5fbfece0  rsp: 0x00007fff5fbf6930
   r8: 0x0000000000000000   r9: 0x0000000000000002  r10: 0x00007fff89397b0f  r11: 0x00007fff80ad20d6
  r12: 0x00007fff5fbf6a50  r13: 0x00000001015f6e40  r14: 0x00007fff7017f500  r15: 0x0000000000000000
  rip: 0x0000000102a23833  rfl: 0x0000000000010246  cr2: 0x0000000000000090
<snip>

I have tried different smiles strings (some pulled from pubchem which render correctly in other programs) and I have also tried reading from and sdf file:

>> molfile = pybel.readfile('sdf', 'mymols.sdf')
>> mymol = molfile.next()

<segmentation fault>

Can anyone suggest what might be happening?  It would be great if I could get Pybel to work on the Mac.  I

Thanks
Hassan

Hassan Mamdani MSci MPhil MRSC

Research Scientist

ProMetic Biosciences UK

211 Cambridge Sciene Park, Milton Road

Cambridge, CB4 0ZA

 

Tel: +44 (0) 1223 433861

fax: +44 (0) 1223 420270

Email:   [hidden email]

 

P  Please consider the environment before printing this e-mail.

           Avant d'imprimer ce courriel, pensez à l'environnement.

 

Notice: This email is confidential and intended for the exclusive use of the addressee.  If you are not the intended addressee, please notify us immediately by e-mail, delete the original without keeping a copy and do not disclose its content or use the information for any purpose.

Avis : Ce courriel est confidentiel et à l'usage exclusif du destinataire. Si vous avez reçu ce courriel par erreur, veuillez nous en informer immédiatement par courriel, effacer l'original sans en conserver de copie et ne pas en dévoiler le contenu ni utiliser l’information pour quelque fin que ce soit.


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: help - segmentation fault with Pybel on Mac OS x

Geoffrey Hutchison
I have managed to compile OpenBabel with the python bindings on my Mac by following the instructions on the OpenBabel website.  OpenBabel works fine form the command line, and I can import pybel into python.  However whenever I try to use pybel I get a segmentation error  For example:

Yes, I need to fix up the build script for the Mac python bindings (and probably other scripting bindings as well). The problem is that the openbabel.so build for the Python binding will link to the files in your build directory, not the installed libopenbabel.dylib. :-(

So what you want to do is this:

otool -L /Library/Python/2.6/site-packages/_openbabel.so

You should see something like this:
/Library/Python/2.6/site-packages/_openbabel.so:
/Users/ghutchis/Devel/build/openbabel/lib/libopenbabel.4.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)

Make a note of the first path (to libopenbabel.dylib) and copy that text.

Then run:

sudo install_name_tool -change [old path] /usr/local/lib/libopenbabel.4.dylib /Library/Python/2.6/site-packages/_openbabel.so

That should do it. If not, please let me know.

Hope that helps,
-Geoff

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss