installing python-igraph on linux

This is part of the Installing python-igraph series. This page describes the standard installation methods of the stable version, so you need to have administrator privileges on the computer. If you want to install locally with virtualenv see Testing environment for python-igraph.

Ubuntu Linux

For versions Karmic (9.10), Lucid (10.4, LTS) and Maverick (10.10).

If you want a version that is different from the official stable version (e.g., the latest nightly), you need to build it from source like in the Debian Lenny section. The description below is more convenient for the latest stable version.

Add the Launchpad repository of igraph to apt:

sudo add-apt-repository ppa:igraph/ppa

Then update your package database and install the python-igraph package:

sudo apt-get update
sudo apt-get install python-igraph

You can use the igraph module of Python now :-)


Debian Lenny

Installing the igraph C library

First, install some packages that we will need later:

aptitude install build-essential libxml2-dev libglpk-dev libgmp3-dev libblas-dev liblapack-dev libarpack2-dev python-dev

This step needs administrator privileges (use su or sudo if you are not root).

Download the source of the C library and the Python source from and extract them like this:

tar xzf python-igraph-0.5.4.tar.gz
tar xzf igraph-0.5.4.tar.gz

First we compile and install the C core of igraph. Change to the igraph-0.5.3 folder and do the following:

cd igraph-0.5.4
make install

The last step needs administrator privileges again.

Because Debian (and Ubuntu) will install the .so files into /usr/local/lib (/usr/lib is reserved for the core system and it should not be used by packages that were compiled and installed by the user), you need to put the following line into ~/.bashrc to tell the system to look for libraries there as well:

export LD_LIBRARY_PATH=/usr/local/lib/

Log out and log in again to ensure that the changes take effect.

Alternatively, you can add /usr/local/lib as a new line to the end of /etc/ if you want to enable these changes system-wide. Make sure you run ldconfig after tweaking /etc/

Installing the Python binding

Change to the python-igraph-0.5.4 folder, and start the installation:

cd ../python-igraph-0.5.4
python build
python install

The last step requires administrator privileges again.

Debian Squeeze

This version includes pre-compiled packages for the C core of igraph, so you don't need to build them from source:

aptitude install libigraph0 libigraph0-dev

After this, you can build the Python binding (see the sections about Debian Lenny above or Other distributions below).

Other distributions

For other distributions you can search for the libigraph (libigraph0) package in the packages, or build it from source, like in Debian Lenny section, but in most distributions you do not need the line export LD_LIBRARY_PATH=/usr/local/lib/ in ~/.bashrc.

The Python binding can be installed from the source that can be found in the Python Package Index . You can use one of three methods:

With easy-install (if installed)

easy_install python-igraph

You need administrator privileges (use su or sudo if you are not root).

With pip (if installed)

pip install python-igraph

You need administrator privileges.

The standard installation process
Download the source (.tar.gz) manually, and install it:

tar xzf python-igraph-0.5.4.tar.gz
cd python-igraph-0.5.4
python install

The last step needs administrator privileges (use su or sudo if you are not root).

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.