ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so, 2): Library not loaded: /opt/local/lib/libxml2.2.dylib
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so
Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0
I was trying to upgrade my AIMBAT package, which uses Obspy. I installed Obspy using Macports, per the instructions on Github.
Hi Greg,
looks like the problem is not directly related to Obspy, but due to libxml2 and py-lxml.
Usually, such problems surface and get fixed pretty fast by the Macports maintainers.
Have you installed the up-to-date versions of these packages?
Could you provide me the command which triggers the problem, so I can have a look at this and reproduce this?
Hi Greg,
from what I see on my system there should be no problem any more (see below):
otool -L /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so:
/opt/local/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.28.0)
/opt/local/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.17.0)
/opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.1.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
You probably should be able to solve the problem by updating your `libxml2` library.
Just do a selfupdate to Macports:
sudo port -v selfupdate
Then update `libxml2`:
sudo port -v upgrade libxml2
Or upgrade `py27-obspy`, which should trigger the update of all dependencies as well:
sudo port -v upgrade py27-obspy
Hi Greg,
I had a similar error on my mac os 10.9.4
You can find several libxml2.2.dylib files on disk and check the versions using otool:
otool -L /sw/lib/libxml2.2.dylib
/sw/lib/libxml2.2.dylib:
/sw/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/sw/lib/liblzma.5.dylib (compatibility version 6.0.0, current version 6.5.0)
/sw/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
otool -L /usr/lib/libxml2.2.dylib
/usr/lib/libxml2.2.dylib:
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 51.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
So maybe you just need to set your LIBRARY and/or LD_LIBRARY_PATH to point to
the right version.
That fixed it for me.
I have no experience using swig, but did you have a look at Cython and scipy.weave?
I am not sure what exactly you need, but both of the named modules are capable of importing c/c++ libraries. I am for instance using scipy.weave with C GSL libs without any issues.
I covered some of this briefly in the 2010 USArray Data Processing short course. I think it is buried in IRIS web site but you can get a cleaner copy at by clicking on the following link:
password is swig2010 That exercise wraps one of the algorithms in seismic unix. Gary pavlis