Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install graph-tool on Mac OS Mavericks with python installed with brew

Install prerequisites

Install Homebrew

Install Python

  • brew install python
  • vim ~/.bash_profile
  • and insert this code:

Set architecture flags

export ARCHFLAGS="-arch x86_64"

Ensure user-installed binaries take precedence

export PATH=/usr/local/bin:$PATH

Load .bashrc if it exists

test -f ~/.bashrc && source ~/.bashrc

  • . ~/.bash_profile
  • easy_install pip # If you don't have already pip installed

Install libraries and prerequisites

  • brew install gcc
  • pip install numpy
  • pip install scipy
  • brew install freetype
  • pip install matplotlib

Install graph-tool with brew

  • brew tap homebrew/science
  • brew install graph-tool
@thenovices

This comment has been minimized.

Show comment
Hide comment
@thenovices

thenovices Mar 26, 2014

Note: google-sparsehash is not required, and a couple people are having trouble compiling google-sparsehash on OSX 10.9

You can skip installing google-sparsehash. Just make sure you run ./configure PYTHON_EXTRA_LDFLAGS="-L/usr/local/bin" --disable-sparsehash and the configure script won't look for the sparsehash headers.

thenovices commented Mar 26, 2014

Note: google-sparsehash is not required, and a couple people are having trouble compiling google-sparsehash on OSX 10.9

You can skip installing google-sparsehash. Just make sure you run ./configure PYTHON_EXTRA_LDFLAGS="-L/usr/local/bin" --disable-sparsehash and the configure script won't look for the sparsehash headers.

@saibalmars

This comment has been minimized.

Show comment
Hide comment
@saibalmars

saibalmars Apr 12, 2014

The problem of googol-sparsehash in OSX 10.9 can be solved by using
brew install google-sparsehash --cc=gcc-4.2

saibalmars commented Apr 12, 2014

The problem of googol-sparsehash in OSX 10.9 can be solved by using
brew install google-sparsehash --cc=gcc-4.2

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 15, 2014

A tool so impossible to install is a real dissuasion from use.

ghost commented Apr 15, 2014

A tool so impossible to install is a real dissuasion from use.

@juliusf

This comment has been minimized.

Show comment
Hide comment
@juliusf

juliusf Jun 26, 2014

Note: when compiling boost, please not that the python bindings are not included by default anymore. This can be solved by using:
brew install --with-c++11 --build-from-source boost -v --with-python

juliusf commented Jun 26, 2014

Note: when compiling boost, please not that the python bindings are not included by default anymore. This can be solved by using:
brew install --with-c++11 --build-from-source boost -v --with-python

@thenovices

This comment has been minimized.

Show comment
Hide comment
@thenovices

thenovices Aug 14, 2014

Installing on a new machine and running into more issues. For some reason, this time around the configure script couldn't find the headers and libraries for boost, so I had to solve via export CPPFLAGS="-I/usr/local/Cellar/boost/1.55.0_2/include -L/usr/local/Cellar/boost/1.55.0_2/lib"

thenovices commented Aug 14, 2014

Installing on a new machine and running into more issues. For some reason, this time around the configure script couldn't find the headers and libraries for boost, so I had to solve via export CPPFLAGS="-I/usr/local/Cellar/boost/1.55.0_2/include -L/usr/local/Cellar/boost/1.55.0_2/lib"

@ktrapeznikov

This comment has been minimized.

Show comment
Hide comment
@ktrapeznikov

ktrapeznikov Oct 20, 2014

homebrew has a separate boost for python now
brew install --with-c++11 --build-from-source boost-python

ktrapeznikov commented Oct 20, 2014

homebrew has a separate boost for python now
brew install --with-c++11 --build-from-source boost-python

@brunsgaard

This comment has been minimized.

Show comment
Hide comment
@brunsgaard

brunsgaard Oct 21, 2014

If you stumple into problems with cairo dependencies, take a look at this issue Homebrew/legacy-homebrew#14123

brunsgaard commented Oct 21, 2014

If you stumple into problems with cairo dependencies, take a look at this issue Homebrew/legacy-homebrew#14123

@danieleb

This comment has been minimized.

Show comment
Hide comment
@danieleb

danieleb Nov 12, 2014

brew install --with-c++11 --build-from-source boost-python did not work for me, but this thread helped http://stackoverflow.com/questions/26189058/ld-library-not-found-for-lboost-python instead.

Now the problem is that make fails with the following message:

ld: library not found for -lCGAL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [libgraph_tool_generation.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

danieleb commented Nov 12, 2014

brew install --with-c++11 --build-from-source boost-python did not work for me, but this thread helped http://stackoverflow.com/questions/26189058/ld-library-not-found-for-lboost-python instead.

Now the problem is that make fails with the following message:

ld: library not found for -lCGAL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [libgraph_tool_generation.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
@wah

This comment has been minimized.

Show comment
Hide comment
@wah

wah Nov 20, 2014

I've had a hell of a time installing this, but I think I finally have it working. Some other dependencies available on Homebrew that aren't mentioned above are:

  • gtk+3
  • gdk-pixbuf
  • librsvg
  • pygobject
  • hicolor-icon-theme

I installed all of these after running make install on graph-tool itself. I'm pretty sure there were others, but I lost count. I also had problems with interactive graphs crashing at runtime because of a missing icon called 'system-run' in GTK. I got around this by putting a file called system-run.png in /usr/share/icons/ and giving read permission to all.

wah commented Nov 20, 2014

I've had a hell of a time installing this, but I think I finally have it working. Some other dependencies available on Homebrew that aren't mentioned above are:

  • gtk+3
  • gdk-pixbuf
  • librsvg
  • pygobject
  • hicolor-icon-theme

I installed all of these after running make install on graph-tool itself. I'm pretty sure there were others, but I lost count. I also had problems with interactive graphs crashing at runtime because of a missing icon called 'system-run' in GTK. I got around this by putting a file called system-run.png in /usr/share/icons/ and giving read permission to all.

@prheenan

This comment has been minimized.

Show comment
Hide comment
@prheenan

prheenan Dec 19, 2014

I was able to configure after brew installing / rebuilding boost from scratch, as described here (mentioned by others above): http://stackoverflow.com/questions/26189058/ld-library-not-found-for-lboost-python.

When I tried to make, I found the following error:

./../numpy_bind_old.hh:58:65: error: 'value' is not a member of 'boost::mpl::aux::wrapped_typeboost::mpl::aux::type_wrapper<mpl_::void_ >::type {aka mpl_::void_}'
int val_type = boost::mpl::at<numpy_types,ValueType>::type::value;

As also described here: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Graph-Tool-Mac-OS-Build-Errors-td4025790.html

I switched my python binary to point to "/usr/bin/pythonw2.7" based on the link, which took me a couple hours to find (note: that is version Python 2.7.5 (default, Mar 9 2014, 22:15:05)), as described in the link. Previously, I was using Python 3.4.1 (default, May 19 2014, 13:10:29). Using the pythonw2.7 binary still didn't seem to help. It looks to me like there is some boost compatibility issue. Anybody else seeing this?

prheenan commented Dec 19, 2014

I was able to configure after brew installing / rebuilding boost from scratch, as described here (mentioned by others above): http://stackoverflow.com/questions/26189058/ld-library-not-found-for-lboost-python.

When I tried to make, I found the following error:

./../numpy_bind_old.hh:58:65: error: 'value' is not a member of 'boost::mpl::aux::wrapped_typeboost::mpl::aux::type_wrapper<mpl_::void_ >::type {aka mpl_::void_}'
int val_type = boost::mpl::at<numpy_types,ValueType>::type::value;

As also described here: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Graph-Tool-Mac-OS-Build-Errors-td4025790.html

I switched my python binary to point to "/usr/bin/pythonw2.7" based on the link, which took me a couple hours to find (note: that is version Python 2.7.5 (default, Mar 9 2014, 22:15:05)), as described in the link. Previously, I was using Python 3.4.1 (default, May 19 2014, 13:10:29). Using the pythonw2.7 binary still didn't seem to help. It looks to me like there is some boost compatibility issue. Anybody else seeing this?

@munum

This comment has been minimized.

Show comment
Hide comment
@munum

munum Jan 25, 2015

For now it is brew install boost-python.

munum commented Jan 25, 2015

For now it is brew install boost-python.

@stared

This comment has been minimized.

Show comment
Hide comment
@stared

stared Apr 6, 2015

This is a rather long list. What is wrong with using direct recipe from https://github.com/Homebrew/homebrew-science/blob/master/graph-tool.rb ?

$ brew tap homebrew-science
$ brew install graph-tool

It did work for me (I had brew-installed Python, and XCode).

stared commented Apr 6, 2015

This is a rather long list. What is wrong with using direct recipe from https://github.com/Homebrew/homebrew-science/blob/master/graph-tool.rb ?

$ brew tap homebrew-science
$ brew install graph-tool

It did work for me (I had brew-installed Python, and XCode).

@kostnermo

This comment has been minimized.

Show comment
Hide comment
@kostnermo

kostnermo Apr 9, 2015

Use that one, please.
$ brew tap homebrew/science
$ brew install graph-tool

kostnermo commented Apr 9, 2015

Use that one, please.
$ brew tap homebrew/science
$ brew install graph-tool

@openp2pdesign

This comment has been minimized.

Show comment
Hide comment
@openp2pdesign

openp2pdesign Sep 7, 2015

This gist is an old solution, that was also featured on the graph-tool website back then.
But now the best solution is the official one with Brew, which came later:

$ brew tap homebrew-science
$ brew install graph-tool

Owner

openp2pdesign commented Sep 7, 2015

This gist is an old solution, that was also featured on the graph-tool website back then.
But now the best solution is the official one with Brew, which came later:

$ brew tap homebrew-science
$ brew install graph-tool

@openp2pdesign

This comment has been minimized.

Show comment
Hide comment
@openp2pdesign

openp2pdesign Sep 7, 2015

I've updated the file to the current process.

Owner

openp2pdesign commented Sep 7, 2015

I've updated the file to the current process.

@aa21

This comment has been minimized.

Show comment
Hide comment
@aa21

aa21 Dec 24, 2017

Ending 2017, this worked perfectly for me.

Edit: 1 Week later - NO it doesn't work. I spoke far far too soon. When I try to run a simple script with graph-tool it crashes. I'm not even back to square one, I'm at square -15. Seriously thinking of abandoning graph-tool and heading for NetworkX or iGraph. Shame.

aa21 commented Dec 24, 2017

Ending 2017, this worked perfectly for me.

Edit: 1 Week later - NO it doesn't work. I spoke far far too soon. When I try to run a simple script with graph-tool it crashes. I'm not even back to square one, I'm at square -15. Seriously thinking of abandoning graph-tool and heading for NetworkX or iGraph. Shame.

@maxvonhippel

This comment has been minimized.

Show comment
Hide comment
@maxvonhippel

maxvonhippel Apr 28, 2018

The brew tap homebrew/science should be updated to brew tap brewsci/bio. Otherwise, thanks for this!

maxvonhippel commented Apr 28, 2018

The brew tap homebrew/science should be updated to brew tap brewsci/bio. Otherwise, thanks for this!

@joanna350

This comment has been minimized.

Show comment
Hide comment
@joanna350

joanna350 Jun 5, 2018

what about for conda-installed python users?

joanna350 commented Jun 5, 2018

what about for conda-installed python users?

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