|
|
# How to install graph-tool
|
|
|
|
|
|
## Using Docker
|
|
|
|
|
|
The most hands-free and OS-agnostic way to install `graph-tool` is using [Docker](https://www.docker.com/). If you have Docker installed, this can be done simply by running:
|
|
|
```bash
|
|
|
docker pull tiagopeixoto/graph-tool
|
|
|
```
|
|
|
This will download a Docker image based on [Arch GNU/Linux](https://www.archlinux.org/), that contains graph-tool, and can be run in any modern GNU/Linux distribution, MacOS X and Windows. It contains some other useful Python packages, such as [matplotlib](http://matplotlib.org/) and [IPython](https://ipython.org/). After the image is pulled, you can start an interactive python shell in the container by running:
|
|
|
```bash
|
|
|
docker run -it tiagopeixoto/graph-tool ipython
|
|
|
```
|
|
|
which will give you a Python 3 environment with `graph-tool` installed:
|
|
|
```
|
|
|
Python 3.6.0 (default, Jan 16 2017, 12:12:55)
|
|
|
Type "copyright", "credits" or "license" for more information.
|
|
|
|
|
|
IPython 5.1.0 -- An enhanced Interactive Python.
|
|
|
? -> Introduction and overview of IPython's features.
|
|
|
%quickref -> Quick reference.
|
|
|
help -> Python's own help system.
|
|
|
object? -> Details about 'object', use 'object??' for extra details.
|
|
|
|
|
|
In [1]: from graph_tool.all import *
|
|
|
In [2]:
|
|
|
```
|
|
|
|
|
|
# Native installation
|
|
|
|
|
|
Python modules are usually very easy to install, typically requiring nothing more that `pip install <package>` for basically any operating system. For `graph-tool`, however, the situation is different. This is because, in reality, `graph-tool` is a C++ library wrapped in Python, and it has many C++ dependencies such as [Boost](http://www.boost.org/), [CGAL](http://www.cgal.org/) and [expat](http://expat.sourceforge.net/), which are not installable via Python-only package management systems such as [pip](http://www.pip-installer.org/). Because the module lives between the C++ and Python worlds, its installation is done more like a C++ library rather than a typical python module. This means it inherits some of the complexities common of the C++ world that some Python users do not expect.
|
|
|
|
|
|
The easiest way to get going is to use a package manager, for which the installation is fairly straightforward. This is the case for some [GNU/Linux distributions](#gnulinux) (Arch, Gentoo, Debian & Ubuntu) as well as for [MacOS](#macos) users using either [Macports](http://www.macports.org/) or [Homebrew](http://brew.sh/).
|
... | ... | |