This document will cover the steps involved in installation of python-igraph
package for python 2.7. For python 3.x, the steps will likely be similar, but possibly not identical.
The python-igraph package requires cairo
library, and Pycairo
python package, and igraph
C core. cairo
is a 2D graphics library with support for multiple output devices and Pycairo
is a set of python bindings for cairo
graphics library.
In this document, it is assumed that the user does not have root access and thus uses --prefix
to indicate a local directory where /lib
and /bin
can be located, for which the user has write privilage.
You can download the source code corresponding to the most recent release of cairo (March 2015), along with a patch from the links provided here :
wget http://cairographics.org/releases/cairo-1.14.0.tar.xz
wget http://www.linuxfromscratch.org/patches/blfs/svn/cairo-1.14.0-upstream_fixes-2.patch
and install as follows:
tar xf cairo-1.14.0.tar.xz
cd cairo-1.14.0/
patch -Np1 -i ../cairo-1.14.0-upstream_fixes-2.patch &&
./configure --prefix=${absolute-path}/trial \
--disable-static \
--enable-tee &&
make
make install
Upon successful installation, you should see that a directory corresponding to cairo
should be created under /lib
in the specified prefix directory.
Libraries have been installed in:
${absolute-path}/trial
The most recent release of Pycairo
is available here.
wget http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2
Installation steps follow:
bunzip2 py2cairo-1.10.0.tar.bz2
tar xvf py2cairo-1.10.0.tar
cd py2cairo-1.10.0/
# preparing configure file using autoconf
libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
# configuring the installation in
./configure --prefix=${absolute-path}/trial
# which should result in the message below in standard err
# Configuration:
# Installation prefix ${absolute-path}/trial
# finally installing py2cairo
make
make install
Successful completion of the steps above will results in addition of a cairo
directory under [prefix]/lib/python2.7/site-packages
. Please make sure that this directory is present on sys.path
variable of your python. To verify, you can check the version of your Pycairo
installation by calling
python -c 'import cairo; print cairo.version'
from your system's command line.
The most recent release of igraph C core is available here.
wget http://igraph.org/nightly/get/c/igraph-0.7.1.tar.gz
Installation steps follow:
tar zxvf igraph-0.7.1.tar.gz
cd igraph-0.7.1
./configure
make
make check
make install
One possible reason that the above process might fail is absence of libxml2-dev
package on your system. In an Ubuntu system, you can verify that by calling
apt-cache search libxml | gre p 'dev'
You can solve this issue by the following installation
sudo apt-get install `libxml2-dev`
Upon successful completion of igraph
C core installation, you should be able to see the path where it is installed in the log message. Please make sure that this path is present in your LD_LIBRARY_PATH
environment variable.
According to igraph
documentation page , OS X users can either follow the process above or install igraph
C core thru Homebrew. Please note that presence of MacPorts or Fink can interfere with the process above if using Homebrew.
Now with the dependencies installed, you can easily install python-igraph using pip
.
pip install python-igraph