2

I executed the brew install homebrew/science/igraph When I execute sudo pip3 install python-igraph, I got the following error

Cannot find the C core of igraph on this system using pkg-config.
We will now try to download and compile the C core from scratch.
Version number of the C core: 0.7.1.post6
We will also try: 0.7.1

Using temporary directory: /private/tmp/pip-build-35vcjf7l/python-igraph/tmp/igraph.4cz7yjcl
Downloading igraph-0.7.1.tar.gz... 0.28%error: <urlopen error retrieval incomplete: got only 992 out of 2967134 bytes>

Can anyone help? Many thanks

1

1 Answer 1

4

Note this post assumes you have homebrew installed and are trying to install on a Mac.

To avoid any issues of python3/python2 I would recommend using python2 because that is what the igraph library is designed to work with. I executed the following codes on a mac and things worked fine.

Instructions to install igraph on python2, in your terminal execute these lines:

brew install cairo
brew install py2cairo
brew install igraph 

Now this last line above line installs the C-core. Final terminal line is:

sudo pip install python-igraph

The above line installs igraph for python2, note these lines take about 2 minutes to complete for me

Next open python2 or idle-from terminal (I used idle).

Mow check in python REPL shell...

import igraph.test
igraph.test.run_tests()

If everything looks ok then you've got igraph in python working for you

Also check this one:

from igraph import *
g = Graph.Famous("petersen")
plot(g)

You should get a nice graphic of the peterson graph (red nodes, small graph)

Sign up to request clarification or add additional context in comments.

11 Comments

I followed your guidelines but I am facing this error : ImportError: dlopen(/Users/alexandreattia/Desktop/Work/py27_venv/lib/python2.7/site-packages/igraph/_igraph.so, 2): Symbol not found: _iconv Referenced from: /Users/alexandreattia/Desktop/Work/py27_venv/lib/python2.7/site-packages/igraph/_igraph.so Expected in: flat namespace in /Users/alexandreattia/Desktop/Work/py27_venv/lib/python2.7/site-packages/igraph/_igraph.so Do you have any idea how to fix it ?
Do you have homebrew installed and are you on a mac? Rather than the error only, please provide the command you called which created the error, this will help me help you.
Yes I am on Mac (High Sierra), I have homebrew (1.3.6). This error was created when I run on python 2.7 import igraph. Thank you very much
Hmm, first thing I would do is look at the log from when homebrew installed igraph on your machine. My first guess is that the location homebrew is using is different from the location that your python 2.7 environment is using.
The easiest way to fix this is to use the python environment that is used by homebrew rather than the other option. To do this you would invoke with a simple python call in the terminal to get a REPL shell.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.