Skip to content

Instantly share code, notes, and snippets.

@v-pravin
Last active April 10, 2020 14:18
Show Gist options
  • Save v-pravin/949fc18d58a560cf85d2 to your computer and use it in GitHub Desktop.
Save v-pravin/949fc18d58a560cf85d2 to your computer and use it in GitHub Desktop.
Installation of graph-tool from source

INSTALLATION OF GRAPH-TOOL FROM SOURCE

System
Requirements as given under - http://graph-tool.skewed.de/download
  1. GCC, version 4.8 or above (version 4.9 is recommended). For MacOS X, the clang compiler is required.
    • sudo apt-get install gcc-4.8
  2. The Boost libraries, version 1.54 or above.
  3. Python version 2.7 or 3 and above.
    • bash Anaconda-2.1.0-Linux-x86_64.sh
  4. The expat library.
  5. The SciPy python module.
    • Included in Anaconda's Python distribution (conda list | grep numpy)
  6. The Numpy python module.
    • Included in Anaconda's Python distribution (conda list | grep scipy)
  7. The CGAL C++ geometry library, version 3.5 or above.
  8. The sparsehash template library (optional, but recommended).
  9. The cairomm, pycairo and matplotlib libraries, used for graph drawing (optional).
  10. The Graphviz packaged for graph drawing, with the python bindings enabled (optional, deprecated).
    • I am not installing this as it is optional.
Download graph-tool

DONE

@v-pravin
Copy link
Author

v-pravin commented Nov 8, 2015

You might have the path with default Python as opposed to Anaconda's Python. Kindly verify.

@floriangeigl
Copy link

hy - thank you for this valuable gist. I extended it in my fork and further compiled an update-to-date Anaconda package (python 2.7 with openmp and boost 1.60) which "should work" if you have gcc >= 5.0 on your machine. I tested the package on two machines running Ubuntu 14.04.04LTS and gcc 5.3.0. Would be nice if someone could try to install the package and see if it works.
conda install graph-tool -c floriangeigl -c msarahan -c conda-forge -c bioconda -c ostrokach -c vgauthier -c salford_systems should do the trick. Using python -c"import graph_tool.all as gt; gt.show_config()" one should see openmp enabled and the warning that GTK+ will not work.

@ttfoley
Copy link

ttfoley commented Mar 29, 2016

Hi floriangeigl,
I tried the above, making sure I had the right g++,gcc.
Everything appears to be fine, but I get the following message when I import:

in ()
----> 1 import graph_tool

/home/tommy/anaconda2/lib/python2.7/site-packages/graph_tool/init.py in ()
103
104 from .dl_import import *
--> 105 dl_import("from . import libgraph_tool_core as libcore")
106 version = libcore.mod_info().version
107

/home/tommy/anaconda2/lib/python2.7/site-packages/graph_tool/dl_import.py in dl_import(import_expr)
55
56 try:
---> 57 exec(import_expr, local_dict, global_dict)
58 finally:
59 sys.setdlopenflags(orig_dlopen_flags) # reset it to normal case to

in ()

ImportError: /home/tommy/anaconda2/lib/python2.7/site-packages/graph_tool/../../../libgomp.so.1: version `GOMP_4.0' not found (required by /home/tommy/anaconda2/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so)

EDIT:
When I run from /usr/bin/python graph_tool works.

@olegsinavski
Copy link

Hi @floriangeigl,
Thank you for the Anaconda packages! However I got into following issue during import:

import graph_tool
../../../../miniconda/envs/test-environment/lib/python2.7/site-packages/graph_tool/__init__.py:3122: in <module>
    openmp_set_schedule("static", 0)
../../../../miniconda/envs/test-environment/lib/python2.7/site-packages/graph_tool/__init__.py:3119: in openmp_set_schedule
    return libcore.openmp_set_schedule(schedule, chunk)
E   ArgumentError: Python argument types in
E       graph_tool.libgraph_tool_core.openmp_set_schedule(str, int)
E   did not match C++ signature:
E       openmp_set_schedule(std::string, int)

Any ideas?

@nahuelalmeira
Copy link

Hi @floriangeigl,

I'm having the same problem than @olegsinyavskiy on Linux Mint 17, do you know what could be happening?

@nahuelalmeira
Copy link

I've also tried uninstalling and installing the package againg, this time with the instructions of @v-pravin. Installation goes well, but when I call the module from python, it gives me the standard ImportError: No module named graph_tool.all. ¿Do you have any clue? Thanks!
(I could manage to install it in another PC, with Ubuntu 14.04 LTS, but I really need to install it in my office PC)

@clement-moulin-frier
Copy link

Hi,

I got the same error as @olegsinyavskiy (even when directly installing graph-tool from apt-get).

Thanks,

@floriangeigl
Copy link

Hi guys (@nahuelalmeira, @olegsinyavskiy, @ttfoley) - I'm sorry I didn't notice you're writing me. I just never had a look at my github notifications.... Anyways I spend a lot of time trying to fix the anaconda pkg and some of my attempts seemed to work (at least to some extend - graph-drawing or multiprocessing mostly fucks up). The current available pkg from my anaconda channel seems to work at least for some guys (including multiproc.). However, I just found out that one can link system libs to anaconda lib. Thus, I would highly recommend to just install the graph-tool version available over apt and then link the install pkg via:

ln -s /usr/lib/python2.7/dist-packages/graph_tool /home/USER/anaconda/lib/python2.7/site-packages/graph_tool

Sry again for not responding earlier -

@madhavij
Copy link

@ttfoley : Hi, I am encountering the same error, were you able to resolve yours? If yes, then how?

@madhavij
Copy link

@v-pravin : Is there any significant difference while installing it in Centos 6.5 using the similar steps?

@jbrant
Copy link

jbrant commented Feb 25, 2018

I'm also getting the same error as nahuelalmeira. What is the resolution for Windows users?

@josemarfdc
Copy link

@jbrant according to graph-tool's developer, it doesn't work on windows. The solution this user found was to install Linux http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Error-installing-graph-tool-on-windows-td4024889.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment