- OS
-
Arch Linux 4.9.11 x86_64
- Python Distribution
-
Anaconda Python 3 https://www.continuum.io/downloads#linux
These installation instructions are adapted from the official ones at https://git.skewed.de/count0/graph-tool/wikis/installation-instructions, to match the requirements of an Anaconda distribution.
-
GCC (latest version, 6.3.1 for me)
-
Boost libraries
-
Python 3.6
-
The
expatXML library -
Scipy
-
Numpy
-
CGAL C++ library
-
sparsehash(optional) -
cairomm,matplotlib(optional, for plotting)
These packages must be installed via conda and via your package
manager (pacman for Arch), in order to satisfy dependencies at build
time. For Arch, run:
pacman -S clang boost expat cgal sparsehash cairomm
For other distributions, you should find similar packages from your standard repositories.
|
Note
|
Do not use another compiler! You have to use the same compiler as the one used to compile the Boost library on your system, and that is very probably GCC. |
-
First, if you don’t have Anaconda, install it by running the official installer. By default, it installs to
/home/user/anaconda3. We will keep the assumption that the default wasn’t changed. -
Create a conda environment for graph-tool and activate it:
conda create -n graph source activate graph
-
Install the required libraries:
conda install -c conda-forge python boost scipy numpy expat cgal conda install -c conda-forge sparsehash conda install -c conda-forge cairomm matplotlib
|
Note
|
We use the community conda-forge channel, because packages
tend to be more up-to-date compared to the official channel.
|
-
Download graph-tool from the official website (https://graph-tool.skewed.de/), version 2.21 at the time of writing. Decompress it.
cd ~/builds tar xjvf graph-tool-2.21.tar.bz2 cd graph-tool-2.21
-
Compile
./configure --prefix=/home/dimitri/anaconda3/envs/graph/ --with-python-module-path=/home/dimitri/anaconda3/envs/graph/lib/python3.6/site-packages make -j2 make install
If you have changed the name of the environment, adapt the paths
provided to ./configure.
|
Note
|
Adapt the -j2 parameter to your system’s number of cores, but
more importantly, to your available memory. Compilation uses a lot
of memory, and you will run quickly into an internal compiler error
if you parallelize too much. To remain conservative, use -j1 or add
some swap. Compilation may be very long (approx. 1 hour on my system).
|
-
Final touches: install
jupyterto have all the usual tools from the Anaconda distribution.
conda install -c conda-forge jupyter
-
Deactivate and reactivate your conda environment (so that your
PATHis updated):
source deactivate source activate graph
-
Open a Jupyter console session
jupyter console
-
Inside the console, run:
from graph_tool.all import * g = Graph() v1 = g.add_vertex() v2 = g.add_vertex() e = g.add_edge(v1, v2) v1.out_degree()
-
All packages come with OpenBLAS instead of MKL. This is not optimal if you have an Intel CPU, as MKL is usually way faster. I think that this is due to
conda-forge, as Continuum probably have an agreement with Intel regarding the MKL license. -
You can not use graph-tool builtin plotting capabilities, as
pycairowas not installed.
If you manage to solve any of this, please let me know!