macos – Can not import openbabel into python


I’m making an attempt to make use of openbabel inside python in macOS BigSur, I’ve put in openbabel and py310-openbabel by way of macports with none downside, nevertheless after I run python3.10 I get the next when importing openbabel:

>>> from openbabel import openbabel
Traceback (most up-to-date name final):
  File "<stdin>", line 1, in <module>
  File "/choose/native/Library/Frameworks/Python.framework/Variations/3.10/lib/python3.10/site-packages/openbabel/__init__.py", line 3, in <module>
    from . import openbabel
  File "/choose/native/Library/Frameworks/Python.framework/Variations/3.10/lib/python3.10/site-packages/openbabel/openbabel.py", line 19, in <module>
    from . import _openbabel
ImportError: dlopen(/choose/native/Library/Frameworks/Python.framework/Variations/3.10/lib/python3.10/site-packages/openbabel/_openbabel.cpython-310-darwin.so, 2): Image not discovered: __ZN9OpenBabel9aromtyperE
  Referenced from: /choose/native/Library/Frameworks/Python.framework/Variations/3.10/lib/python3.10/site-packages/openbabel/_openbabel.cpython-310-darwin.so
  Anticipated in: flat namespace
 in /choose/native/Library/Frameworks/Python.framework/Variations/3.10/lib/python3.10/site-packages/openbabel/_openbabel.cpython-310-darwin.so

The otool output appears right:

otool -L /choose/native/Library/Frameworks/Python.framework/Variations/3.10/lib/python3.10/site-packages/openbabel/_openbabel.cpython-310-darwin.so
/choose/native/Library/Frameworks/Python.framework/Variations/3.10/lib/python3.10/site-packages/openbabel/_openbabel.cpython-310-darwin.so:
    /choose/native/lib/libopenbabel.7.dylib (compatibility model 7.0.0, present model 7.0.0)
    /usr/lib/libc++.1.dylib (compatibility model 1.0.0, present model 905.6.0)
    /usr/lib/libSystem.B.dylib (compatibility model 1.0.0, present model 1292.100.5)

I’ve additionally tried to put in openbabel with pip after eradicating the one put in with macports, which gave me precisely the identical error on import inside python. The command I used to put in it with pip was:

sudo pip-3.10 set up --global-option=build_ext --global-option="-I/choose/native/embrace/openbabel3/" --global-option="-L/choose/native/lib/" openbabel

Any concepts on methods to resolve this?

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here