Icarus
Icarus

Reputation: 1463

Install python igraph on mac

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

Upvotes: 2

Views: 3368

Answers (1)

Lucas Roberts
Lucas Roberts

Reputation: 1343

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)

Upvotes: 4

Related Questions