I installed the python igraph library for anaconda following the directions in this thread installing python igraph, So the C core library and the python package were successfully installed. However, when I tried to import the igraph library in python, I am getting the following error
>>> import igraph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/user/anaconda/lib/python2.7/site-packages/igraph/__init__.py", line 34, in <module>
from igraph._igraph import *
ImportError: dlopen(/Users/user/anaconda/lib/python2.7/site-packages/igraph/_igraph.so, 2): Library not loaded: libxml2.2.dylib
Referenced from: /Users/user/anaconda/lib/python2.7/site-packages/igraph/_igraph.so
Reason: Incompatible library version: _igraph.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0
Looking for similar threads, I found a similar issue here Installation of python igraph with lxml problem. However, there is not a clear way on how to solve this issue. Does anyone know how to fix it? Thanks in advance.
libxml2*.dylib
and they are inusr/local/Cellar/libxml2/2.9.2/lib/
,usr/lib/
,anaconda/lib
,opt/local/lib
andanaconda/pkgs/libxml2-2.9.0-1/lib
which have 12.2.0 10.9.0, 12.2.0, 12.2.0 and 12.0.0 version respectively. Based on the suggestion on your previous thread , should I changed the name of the file inusr/lib/
which is the one that has the 10.9.0 version and leave the others as they are? Thank you. – Paul12.x
, recompile and then rename them back. The reason is that the linker obviously finds the one with version 10.9.0 when you try to import igraph, so if you renamed the one with version 10.9.0, then recompiled igraph, it would still be compiled with 12.0.0. (Also,libxml2
with ABI version 10.9.0 seems to be the system-wide libxml2, so renaming it is dangerous anyway). – TamásReason: Incompatible library version: _igraph.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0.
I was wondering if it is related with the places at which installation is performed. I am using brew to compile and install the corebrew install igraph
and thenpip install python-igraph
. But it seem to be that the core is in/usr/local/Cellar/igraph/0.7.1
and the python package in/Users/user/anaconda/lib/python2.7/site-packages/igraph/
Any suggestion? – Paul