graph-tool-2.2.36 - python -c 'from graph_tool.all import *': ImportError undefined symbol

Hi, using either the latest git repo or 2.2.36 and running:

/usr/bin/python3.3 -c 'import graph_tool ; print(graph_tool.__version__)'
(or even python3.3 -c 'import graph_tool')

results in:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.3/site-packages/graph_tool/__init__.py", line 101, in <module>
    dl_import("from . import libgraph_tool_core as libcore")
  File "/usr/lib64/python3.3/site-packages/graph_tool/dl_import.py", line 57, in dl_import
    exec(import_expr, local_dict, global_dict)
  File "<string>", line 1, in <module>
ImportError: /usr/lib64/python3.3/site-packages/graph_tool/libgraph_tool_core.so: undefined symbol: _ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE

It appears that -lboost_python3_3-mt is not being used, even though my system default is py3.3.

the interesting part of the ./configure log shows:

graph-tool will be installed at: /usr/lib64/python3.3/site-packages

You should pass the option "--with-boost-python=-3-mt" to the configure
script, telling it what suffix should be used.

There is no standard naming across systems, and the configure script
tries some common ones, but it seems to be failing in this case.

Best,
Tiago

You should pass the option "--with-boost-python=-3-mt" to the configure
script, telling it what suffix should be used.

There is no standard naming across systems, and the configure script
tries some common ones, but it seems to be failing in this case.

Great, that worked.

Is it possible to link more than one version of python? I tried passing ./configure both switches, but only the second instance takes effect:

-lboost_python-3.3-mt -lboost_python-2.7-mt
(test case works for py2.7, 3.3 fails with 'undefined symbol')

-lboost_python-2.7-mt -lboost_python-3.3-mt
(test case works for py3.3, 2.7 fails with 'undefined symbol')

test case: python -c 'import graph_tool ; print(graph_tool.__version__)'

Either way, I was able to get both 2.7 and 3.3 working at the same time by modifying the ebuild since it already handles the individual ./configure scripts for all python versions that are available.

Thanks!
-Justin

No. Neither Python nor Boost::Python were designed with this in
mind. They have conflicting symbols, and cannot be linked together in
the same binary.

The usual approach with python 2 and 3 is to install two versions of
each library.

Best,
Tiago