Problem importing on Mac OS X 10.8, installed using MacPorts

Hi,

When trying to import graph-tool the following error message is returned:

from graph_tool.all import *

Fatal Python error: PyThreadState_Get: no current thread

Could you help me solve this problem?

graph-tool version py-graph-tool-2.2.18 was successfully installed
using MacPorts but it fails during importing.

Thanks,
Uldis

Additional information:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8ad91d46 __kill + 10
1 libsystem_c.dylib 0x00007fff8d890df0 abort + 177
2 org.python.python 0x000000010f9ecc01 Py_FatalError + 49
3 org.python.python 0x000000010f9ebffc PyThreadState_Get + 28
4 org.python.python 0x000000010f9e8c7a Py_InitModule4_64 + 58
5 libboost_python-mt.dylib 0x000000010fb74823
boost::python::detail::init_module(char const*, void (*)()) + 35
6 org.python.python 0x0000000109a1fe0d
_PyImport_LoadDynamicModule + 183
7 org.python.python 0x0000000109a1baf2 0x1099da000 + 269042

It crashes while importing the boost lib (so it seems).

Uninstalled and recompiled the boost library (via MacPorts) but am
getting the same problem. Anything else to try?

Thanks,
Uldis

Additional information:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8ad91d46 __kill + 10
1 libsystem_c.dylib 0x00007fff8d890df0 abort + 177
2 org.python.python 0x000000010f9ecc01 Py_FatalError + 49
3 org.python.python 0x000000010f9ebffc

PyThreadState_Get + 28

4 org.python.python 0x000000010f9e8c7a

Py_InitModule4_64 + 58

5 libboost_python-mt.dylib 0x000000010fb74823
boost::python::detail::init_module(char const*, void (*)()) + 35
6 org.python.python 0x0000000109a1fe0d
_PyImport_LoadDynamicModule + 183
7 org.python.python 0x0000000109a1baf2 0x1099da000 + 269042

It crashes while importing the boost lib (so it seems).

Uninstalled and recompiled the boost library (via MacPorts) but am
getting the same problem. Anything else to try?

I haven't seen this error before, but googling around suggest this may
happen if graph-tool is being linked with the system's python libraries,
whereas boost-python was compiled with the macports version. Please
check if this is the case, and if so it may be a good idea to report the
bug to macports people.

Cheers,
Tiago

Thanks. Is the output of "otool -L" enough to see what libraries they are using?

Here's the output -- in case you can see right away what is wrong there:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so:
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.0)
  /opt/local/lib/libboost_iostreams-mt.dylib (compatibility version
0.0.0, current version 0.0.0)
  /opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/lib/libboost_regex-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/lib/libCGAL.10.dylib (compatibility version 10.0.0,
current version 10.0.0)
  /opt/local/lib/libexpat.1.dylib (compatibility version 8.0.0, current
version 8.0.0)
  /opt/local/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current
version 1.0.6)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 169.3.0)
  /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 56.0.0)

/opt/local/lib/libboost_python-mt.dylib:
  /opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.0)
  /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 56.0.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 169.3.0)

Both are using the same version of Pyhon (as far I can guess from "otool -L").

P.S. If this won't solve it, will take it to the MacPorts list.

Cheers,
Uldis

It crashes while importing the boost lib (so it seems).

Uninstalled and recompiled the boost library (via MacPorts) but am
getting the same problem. Anything else to try?

I haven't seen this error before, but googling around suggest this may
happen if graph-tool is being linked with the system's python libraries,
whereas boost-python was compiled with the macports version. Please
check if this is the case, and if so it may be a good idea to report the
bug to macports people.

Thanks. Is the output of "otool -L" enough to see what libraries they are using?

Yes, that gives the correct information.

Here's the output -- in case you can see right away what is wrong there:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so:
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.0)
  /opt/local/lib/libboost_iostreams-mt.dylib (compatibility version
0.0.0, current version 0.0.0)
  /opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/lib/libboost_regex-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/lib/libCGAL.10.dylib (compatibility version 10.0.0,
current version 10.0.0)
  /opt/local/lib/libexpat.1.dylib (compatibility version 8.0.0, current
version 8.0.0)
  /opt/local/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current
version 1.0.6)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 169.3.0)
  /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 56.0.0)

/opt/local/lib/libboost_python-mt.dylib:
  /opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.0)
  /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 56.0.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 169.3.0)

Both are using the same version of Pyhon (as far I can guess from "otool -L").

Everything seems consistent. You should perhaps also try the same thing
with the boost-python library file.

P.S. If this won't solve it, will take it to the MacPorts list.

They'll probably have more experience with this sort of bug.

Cheers,
Tiago

Hello I'm having the exact same problem, how did you solve it please?

attachment.html (1.47 KB)

I should note that I have OS X Mavericks and installed python from
Macports. I hope someone could reply as soon as possible :frowning:

attachment.html (1.64 KB)

As I said before, this is a macports installation issue, and you need to
contact them.

Best,
Tiago