pip
pip

Reputation: 185

Error importing python-igraph

I'm trying to install python-igraph package. Installation works without any warning nor error, but then, when I try to import the module, I get an error:

In [1]: import igraph
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-8e950eb5d8d8> in <module>()
----> 1 import igraph

/usr/local/lib/python2.7/site-packages/igraph/__init__.py in <module>()
     32 # pylint: disable-msg=W0401
     33 # W0401: wildcard import
---> 34 from igraph._igraph import *
     35 from igraph._igraph import __version__, __build_date__
     36 from igraph.clustering import *

ImportError: dlopen(/usr/local/lib/python2.7/site-packages/igraph/_igraph.so, 2): Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
  Referenced from: /usr/local/opt/glpk/lib/libglpk.36.dylib
  Reason: Incompatible library version: libglpk.36.dylib requires version 14.0.0 or later, but libgmp.10.dylib provides version 13.0.0

I can't manage to solve this problem. I saw this post and tried their solutions but it did not work (the problem there was that glpk was not installed, whereas for me it is installed).

To install it I did the following:

brew tap homebrew/science
brew install igraph
sudo pip install python-igraph

And I checked that gmp and glpk were installed with brew install igraph

Does anybody have an idea of how I could manage to install it?

I'm working on Mac os x el capitan, with python2.7

Thanks for your help

Edit from Tamás answer:

I checked, and gmp and glpk do come from homebrew. In fact, /usr/local/opt/gmp is a symlink to <path_to_>Cellar/gmp/6.0.0aand /usr/local/opt/glpk to <path_to_>Cellar/glpk/4.57.

I tried anyway to uninstall igraph (brew uninstall igraph), move somewhere else the files in /usr/local/opt for gmp and glpk, and reinstall igraph. But I get exactely the same error while importing the python module...

Upvotes: 2

Views: 905

Answers (2)

pip
pip

Reputation: 185

Solved:

Thanks to your comments, I realized that, in fact, Homebrew did not have the last version of gmp. So, I downloaded the last version from gmp website, and:

  • uninstalled igraph
  • installed gmp from the downloaded version
  • reinstalled igraph

And now it works, I can import the python package!

Upvotes: 0

Tam&#225;s
Tam&#225;s

Reputation: 48101

It seems like GMP and GLPK are not coming from Homebrew and they are not compatible with each other. You have to fix the installation of GMP and GLPK. Alternatively, you can uninstall igraph, then temporarily move GMP's and GLPK's directories from /usr/local/opt to somewhere else, then install igraph again. igraph will then "think" that GLPK and GMP are not available on your machine and compiles itself without GLPK and GMP support (and disable some features that require GLPK and GMP).

Upvotes: 2

Related Questions