This chapter describes how to install the C core of igraph and its Python bindings on various operating systems.
igraph is primarily a library written in C. It is not a standalone program, nor it is a Python package that you can just drop on your Python path to start using it. Therefore, if you would like to exploit igraph‘s functionality in Python, you must install a few packages. Do not worry, though, there are precompiled packages for the major operating systems, so you will not have to compile igraph from source unless you use an esoteric operating system or you have specific requirements (i.e., adding a custom patch to igraph‘s C core). Precompiled packages are often called binary packages, while the raw source code is usually referred to as the source package.
In general, you should almost always opt for the binary package unless a binary package is not available for your platform or you have some local modifications that you want to incorporate into igraph‘s source. Installation from a binary package tells you how to install igraph from a precompiled binary package on various platforms. Compiling igraph from source tells you how to compile igraph from the source package.
There is a Windows installer for igraph‘s Python interface on the Python Package Index. Download the one that is suitable for your Python version (currently there are binary packages for Python 2.4 and Python 2.5, though it might change in the future). To test the installed package, launch your favourite Python IDE and type the following:
>>> import igraph.test
>>> igraph.test.test()
The above commands run the bundled test cases to ensure that everything is fine with your igraph installation.
Graph plotting in igraph is implemented using a third-party package called Cairo. If you want to create publication-quality plots in igraph on Windows, you must also install Cairo and its Python bindings. The Cairo project does not provide pre-compiled binaries for Windows, but other projects depending on Cairo do, so the preferred way to install Cairo on Windows along with its Python bindings is as follows:
Having done that, you can launch Python again and check if it worked:
>>> from igraph import *
>>> g = Graph.Famous("petersen")
>>> plot(g)
There is a Mac OS X installer for igraph‘s Python interface on the Python Package Index which works for Intel-based Macs running OS X Leopard. The default Python version in Leopard is Python 2.5, so the package is compiled for this specific version. PowerPC users should compile the package themselves (see Compiling igraph from source). To test the installed package, launch your favourite Python IDE or the default command line interpreter and type the following:
>>> import igraph.test
>>> igraph.test.test()
The above commands run the bundled test cases to ensure that everything is fine with your igraph installation.
Graph plotting in igraph is implemented using a third-party package called Cairo. If you want to create publication-quality plots in igraph on Mac OS X, you must also install Cairo and its Python bindings. The Cairo project does not provide pre-compiled binaries for Mac OS X, but MacPorts and Fink does, so you can use them to install Cairo. The Cairo homepage <http://www.cairographics.org> gives you some installation instructions. However, this is only one half of the job, you will also need the Python bindings of Cairo from the PyCairo homepage <http://www.cairographics.org/pycairo>. At the moment there are no precompiled PyCairo packages for Mac OS X either.
TODO: detailed compilation instructions for PyCairo