Graph-tool was tested extensively only on GNU/Linux and MacOS X systems, but should also be usable on other systems where the below requirements are met.
Having installed the above dependencies, the module can be compiled in the usual way:
$ ./configure $ make
After compilation, the module can be installed in the default Python module directory by running:
$ make install
Although graph-tool is a Python library, it is implemented in C++, and thus has C++ dependencies such as Boost, CGAL and expat, which are not installable via Python-only package management systems such as pip or EasyInstall. Unlike most GNU/Linux distributions, the MacOS X system does not include integrated package management with automated dependency tracking, which means that the dependencies would have to be installed individually by hand. Since they also have their own dependencies, this would trigger the manual installation of many libraries, which is quite time consuming, and is not recommended. Instead, the best option is use one of the third-party package management software available, such as Macports or Homebrew. The recommended choice is Macports, which allows the installation of graph-tool with a single command:
port install py-graph-tool
Graph-tool requires large amounts of RAM (~4 GB) during compilation, because it uses lots of template metaprogramming. The supported compiler, GCC, is still not very well optimized for this, which means that even though the program is relatively small, it will still use up lots of RAM during compilation, specially if optimizations are used (and you do want to use them). See for instance GCC bug 12850.
An alternative is to use the clang compiler, which requires about half as much RAM, but tends to generate sightly slower code, and currently lacks OpenMP support.
graph-tool can run several of its algorithms in
to do this, which provides a straightforwards way of
converting serial code into parallel code. OpenMP is an
extension to the Fortran, C and C++ languages, which
directives to achieve automatized code
parallelization. Since it uses compiler directives
#pragma in C/C++), it maintains backwards
compatibility with compilers which do not support OpenMP,
and the code is then compiled cleanly as regular serial
code. Thus, support for parallel code in graph-tool is quite
optional. If you wish to enable it, just pass the option
--enable-openmp" to the configure script.
For Debian, add the
following lines to your
deb http://downloads.skewed.de/apt/DISTRIBUTION DISTRIBUTION main deb-src http://downloads.skewed.de/apt/DISTRIBUTION DISTRIBUTION main
DISTRIBUTION can be any one of
For Ubuntu, add the following lines
deb http://downloads.skewed.de/apt/DISTRIBUTION DISTRIBUTION universe deb-src http://downloads.skewed.de/apt/DISTRIBUTION DISTRIBUTION universe
DISTRIBUTION can be any one of
apt-get update, the package can be installed with
apt-get install python-graph-tool
or if you want to use Python 3
apt-get install python3-graph-tool
If you want to verify the packages, you should use the
After saving it to a file, you should add it to your list with
apt-key add <key's filename>
Afterwards, you can run
apt-key list, which
should give you the following details about the key:
pub 4096R/98507F25 2013-10-17 [expires: 2018-10-16] uid Tiago de Paula Peixoto <firstname.lastname@example.org> uid Tiago de Paula Peixoto <email@example.com> sub 4096R/1A7ECE03 2013-10-17 [expires: 2018-10-16] sub 4096R/23F08CAF 2013-10-17 [expires: 2018-10-16]
An ebuild for graph-tool is included in the default Gentoo repository. Just do
to install it.
Packages for Arch are available in the Arch User Repository. You can install it with yaourt:
yaourt -S python2-graph-tool
yaourt -S python-graph-tool
depending on the python version. Thanks for Daniel Müllner for providing the installation scripts!
port install py-graph-tool
If you want to install the latest development version from git, you can use this portfile.
TL;DR : Just use clang for everything.
Make sure you use the same compiler to compile the whole stack (Python, Boost, etc) or you may lead into problems. Since more recent versions of graph-tool, a compiler which supports C++11 is required.
In an ideal world, the correct version should be the latest one from the "stock" FSF GCC, however it does not seem to be very well supported in the platform, and will lead to strange segfaults when using the library. The bastardized version from Apple (currently version 4.2) seems to work properly on the platform, but is too outdated to compile graph-tool (i.e. it fails to compile valid C++ code, and does not support C++11 properly), and is being deprecated. The clang compiler seems to be the only viable option on the platform, and should therefore be used.
(If possible, a much better option would be to use a less defective platform in the first place.)
ERROR:root:Could not find any typelib for Gtk ERROR:root:Could not find any typelib for Gdk ERROR:root:Could not find any typelib for GdkPixbuf
gi._glib.GError: Couldn't recognize the image file format for file '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/draw/graph-tool-logo.svg' Exception AttributeError: "'GraphWindow' object has no attribute 'graph'" in
port install librsvg
>>> import graph_tool dyld: lazy symbol binding failed: Symbol not found: __ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFNSt3__14pairIPvS2_EES5_E Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so Expected in: flat namespace
We use Git for source revision control and code sharing. The whole tree can be checked out with the following command:
git clone firstname.lastname@example.org:count0/graph-tool.git
For further instructions on how to use Git, see the documentation.
The git public repository can be browsed online here.