what could be causing a dlopen() issue when importing graph_tool?
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? -- Lev Givon Bionet Group http://www.columbia.edu/~lev/ http://lebedov.github.io/
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 modules (see: http://stackoverflow.com/questions/19663366/dlopen-fails-in-boost-python-mod...). Here are some context managers I use to import modules that are causing me problems:
from contextlib import contextmanager import sys @contextmanager def preserve_dlopenflags(flags): """A context manager that temporarily sets the dlopen flags and then returns them to previous values. """ outer_flags = sys.getdlopenflags() try: sys.setdlopenflags(flags) yield finally: sys.setdlopenflags(outer_flags) @contextmanager def boost_python_dlopen_flags(): """A context manager that temporarily sets the dlopen flags for loading multiple boost.python modules and then returns them to previous values. """ flags = None try: import DLFCN flags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL except: import warnings warnings.warn('Do not know which dlopen flags to set.') if None != flags: with preserve_dlopenflags(flags): yield else: yield
Received from John Reid on Fri, Mar 28, 2014 at 11:04:54AM EDT:
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 modules (see: http://stackoverflow.com/questions/19663366/dlopen-fails-in-boost-python-mod...). Here are some context managers I use to import modules that are causing me problems:
Thanks, John - this fixed the problem. -- Lev Givon Bionet Group http://www.columbia.edu/~lev/ http://lebedov.github.io/
participants (2)
-
John Reid -
Lev Givon