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 =========================== Using python version: 3.3.5 =========================== checking for boostlib >= 1.53.0... yes checking whether the Boost::Python library is available... yes checking for exit in -lboost_python... no checking for exit in -lboost_python... (cached) no checking for exit in -lboost_python-2.7-mt... yes if I recompile boost without py2.7 support (py3.3 only), then the interesting part of the ./configure log shows: graph-tool will be installed at: /usr/lib64/python3.3/site-packages =========================== Using python version: 3.3.5 =========================== checking for boostlib >= 1.53.0... yes checking whether the Boost::Python library is available... yes checking for exit in -lboost_python... no checking for exit in -lboost_python... (cached) no checking for exit in -lboost_python-2.7... no checking for exit in -lboost_python-3-mt... yes and the test command works: $/usr/bin/python3.3 -c 'import graph_tool ; print(graph_tool.__version__)' 2.2.36 (commit e3865108, Thu Jan 8 17:03:44 2015 +0100) More detail on this issue is available in the gentoo bug tracker: https://bugs.gentoo.org/show_bug.cgi?id=536734 How do we get the Makefile to have BOOST_PYTHON_LIB = boost_python-3-mt instead of BOOST_PYTHON_LIB = boost_python-2.7-mt when boost has been compiled for 2.7 and 3.3? Thanks! -Justin Keogh
On 17.01.2015 13:10, graph-tool@v6y.net wrote:
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 =========================== Using python version: 3.3.5 =========================== checking for boostlib >= 1.53.0... yes checking whether the Boost::Python library is available... yes checking for exit in -lboost_python... no checking for exit in -lboost_python... (cached) no checking for exit in -lboost_python-2.7-mt... yes
if I recompile boost without py2.7 support (py3.3 only), then the interesting part of the ./configure log shows:
graph-tool will be installed at: /usr/lib64/python3.3/site-packages =========================== Using python version: 3.3.5 =========================== checking for boostlib >= 1.53.0... yes checking whether the Boost::Python library is available... yes checking for exit in -lboost_python... no checking for exit in -lboost_python... (cached) no checking for exit in -lboost_python-2.7... no checking for exit in -lboost_python-3-mt... yes
and the test command works:
$/usr/bin/python3.3 -c 'import graph_tool ; print(graph_tool.__version__)' 2.2.36 (commit e3865108, Thu Jan 8 17:03:44 2015 +0100)
More detail on this issue is available in the gentoo bug tracker: https://bugs.gentoo.org/show_bug.cgi?id=536734
How do we get the Makefile to have
BOOST_PYTHON_LIB = boost_python-3-mt instead of BOOST_PYTHON_LIB = boost_python-2.7-mt
when boost has been compiled for 2.7 and 3.3?
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 -- Tiago de Paula Peixoto <tiago@skewed.de>
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
On 19.01.2015 12:22, graph-tool@v6y.net wrote:
Is it possible to link more than one version of python?
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 -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
graph-tool@v6y.net -
Tiago de Paula Peixoto