[graph-tool] what could be causing a dlopen() issue when importing graph_tool?
johnbaronreid at netscape.net
Fri Mar 28 16:04:54 CET 2014
On 28/03/14 14:56, Lev Givon wrote:
> I've installed the 2.2.31-1 graph-tool package for Ubuntu 13.10 x86_64 on my
> system. Although I can import it from within a regular Python 2.7.5 session
> without any problems, I can't seem to import it successfully from within a virtualenv in which I've
> installed a range of other packages (the virtualenv is configured to also access
> globally installed Python packages):
>>>> import graph_tool
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line 100, in <module>
> dl_import("from . import libgraph_tool_core as libcore")
> File "/usr/lib/python2.7/dist-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/lib/python2.7/dist-packages/graph_tool/libgraph_tool_core.so: invalid mode for dlopen(): Invalid argument
> Before I manually go through all of the packages installed in the virtualenv,
> does anyone have any ideas as to what sort of things might be causing
> the above import problem?
I've had some problems with this in the past with other boost.python
Here are some context managers I use to import modules that are causing
from contextlib import contextmanager
"""A context manager that temporarily sets the dlopen flags and then returns them to previous values.
outer_flags = sys.getdlopenflags()
"""A context manager that temporarily sets the dlopen flags for loading multiple
boost.python modules and then returns them to previous values.
flags = None
flags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL
warnings.warn('Do not know which dlopen flags to set.')
if None != flags:
More information about the graph-tool