I am using Mac. I installed igraph in Python with pip install igraph and it was working well, except for plotting the graphs.
I searched online and I installed cairo with brew install cairo. Ever since, I am getting the following error anytime I simply import igraph:
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': dlopen(libcairo.so.2, 0x0002): tried: '/Users/<username>/opt/anaconda3/lib/libcairo.so.2' (no such file)
and the error message continues with several folders where it tried to look for cairo.
It seems the installation of cairo was not successful. So I tried install cairo using pip install pycairo, but I cannot install it:
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
Related
I want to install a package with this command: pip install git+https://github.com/BioSystemsUM/mewpy.git
It collects the package, but at the end it shows:
Installing collected packages: ruamel.yaml, pathos, matplotlib, boolean.py, jmetalpy, cobamp, mewpy
Attempting uninstall: ruamel.yaml
Found existing installation: ruamel-yaml 0.15.46
ERROR: Cannot uninstall 'ruamel-yaml'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
I couldn't find a way to solve this issue and install this package. Any suggestion's very appreciated.
I am following this official guide for building a package for anaconda based on a skeleton. I just want to build the example package used in the tutorial, which is pyinstrument.
I am using anaconda2 version 4.5.11 under MacOS High Siera (10.13.6).
When running the command conda_build pyinstrument, I am getting the following error (full output here):
File
"/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cffi/vengine_cpy.py",
line 159, in load_library
raise VerificationError(error) cffi.error.VerificationError: importing
'/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so':
dlopen(/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so,
2): Library not loaded: #loader_path/../../../libcrypto.1.0.0.dylib
Referenced from:
/Users/me/anaconda2/envs/blbuild/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_4ed9e37dx4000d087.so Reason: image not found
I have already tried reinstalling openssl via brew, because I found this recommendation when searching SO for the error message, it had no effect on the error though. My openssl version from brew is 1.0.2p in case that matters.
What am I doing wrong?
I was able to finally resolve this issue. The solution was to manually install a package that seems to be required:
conda install cryptography
After successfully installing libtiff on win7 I try to run:
tif = TIFF.open("sometiff.tiff")
I get the following error:
File "C:\Python27\ArcGIS10.2\lib\site-packages\libtiff\libtiff_ctypes.py",
line 41, in <module> raise
ImportError: Failed to find TIFF library.
Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|..
I'm not sure what I need to add to the windows path to make this work successfully.
The directory that contains the dll for libtiff needs to be in your PATH environment variable.
If you did pip install libtiff, then you would have installed it using libtiff from pypi. This seems to be a "wrapper" around libtiff, so you will also need to install the actual libtiff Setup program.
Depending on what you are doing, you may want to look into a more complete distribution of python on windows such as Anaconda, which seems to be quite popular, or Enthought, which the subscription version is well supported. (I believe there is a subscription version of Anaconda, but I have not used it.)
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...
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).
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!
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.
Anaconda Python is weird - it ships with its own version of libxml2 and when you run pip install python-igraph, igraph is probably linked against it. However, when you try to import igraph, the linker finds the system-wide libxml2, which has a lower ABI version, so that's why you see the error message.
The workaround for this is to ensure that during the compilation stage, Anaconda Python's libxml2 is not picked up by the compiler. setup.py in the Python interface of igraph actually contains this workaround - it tries to detect when you are compiling igraph against Anaconda Python on OS X and then it tweaks the environment a bit to ensure that the linker picks up the right version of libxml2. However, this workaround is enabled only if you do not have the C core of igraph installed on your machine - the installer will download the C core, tweak the environment to work around Anaconda Python, then compile the C core and the Python interface together in one single step.
So, the solution is probably one of the following:
Move Anaconda Python's libxml2 out of the way (or maybe rename xml2-config from Anaconda Python's distribution temporarily), then compile and install the C core from Homebrew. (Use brew unlink igraph, brew uninstall igraph, brew install igraph to be on the safe side). Then you can run pip install python-igraph.
Remove Homebrew's igraph entirely and just run pip install python-igraph - it will download the C core, perform the necessary tweaks and then compile everything.
I had exactly the same issue and installing/force linking libxml2 worked for me:
brew install libxml2
brew link --force libxml2
Others also report the same solution and it appears to be working.