Can't import graph-tool

I try to import graph-tool in Python 2.7 with

/from graph_tool.all import */

Each time I execute the above command the following error is returned and
Python crashes.

dyld: lazy symbol binding failed: Symbol not found:
__ZN5boost6python6detail11init_moduleEPKcPFvvE
Referenced from:
/usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
Expected in: flat > namespace

dyld: Symbol not found: __ZN5boost6python6detail11init_moduleEPKcPFvvE
Referenced from:
/usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
Expected in: flat namespace

Trace/BPT trap: 5

I installed graph-tool using homebrew on Mac OSX 10.10. Does anyone what's
going on here?

There is probably a mismatch between the python version you are using,
and the one used to compile boost::python and graph-tool.

For example, you might be using the system's python, whereas
graph-tool/python were compiled with a version installed via homebrew.

If you are still having trouble, open an issue at the homebrew project
page.

Best,
Tiago

MichaelB <michael.blass <at> uni-hamburg.de> writes:

I try to import graph-tool in Python 2.7 with

/from graph_tool.all import */
/>
Each time I execute the above command the following error is returned and
Python crashes.

> dyld: lazy symbol binding failed: Symbol not found:
> __ZN5boost6python6detail11init_moduleEPKcPFvvE Referenced from:
> /usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
> Expected in: flat > namespace
> >
> dyld: Symbol not found: __ZN5boost6python6detail11init_moduleEPKcPFvvE
> Referenced from:
> /usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
> Expected in: flat namespace
> >
> Trace/BPT trap: 5
> >
I installed graph-tool using homebrew on Mac OSX 10.10. Does anyone what's
going on here?

-- View this message in context:
http://main-discussion-list-for-the-graph-tool-

project.982480.n3.nabble.com/Can-t-import-graph-tool-tp4026208.html

Sent from the Main discussion list for the graph-tool project mailing list
archive at

Nabble.com.

_______________________________________________ graph-tool mailing list
graph-tool <at> skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool

I had something similar happen the first couple times I tried to make MacOSX
10.10, Anaconda, and graph-tool work together.

In my case it failed with Fatal Python error: PyThreadState_Get: no current and
then crashed the kernel, but as Tiago knows it's indeed probably a mismatch
between the compiler used for boost vs graph-tool.

I finally succeeded with homebrew by compiling everything from sources instead
of using bottles, thus insuring the same compiler (clang) had been used for
everything. Takes quite a while but it worked.

brew -v install --with-icu4c --build-from-source --with-c++11 boost

brew -v install --with-icu4c --build-from-source --with-c++11 boost-python

brew -v install --build-from-source graph-tool --without-scipy ...
--without-matplotlib --without-numpy

First time I installed boost without the --with-c++11 option and importing
graph-tool kept crashing in the same manner. Simply recompiling boost and
boost-python with it after everything else was already installed fixed it.

I haven't yet completely figured out how to cleanly install all components in
the anaconda directory, but I get away with it for now using

import site site.addsitedir('/usr/local/lib/python2.7/site-packages/') import
graph_tool.all as gt

at the beginning of projects using graph-tool. If you're using MacPorts I
suspect you won't have to do this, and also that the necessary compile options
should be similar that those for homebrew.

Philippe