kilojoules kilojoules - 1 year ago 178
C++ Question

What does `Fatal Python error: PyThreadState_Get: no current thread` mean?

I am passing an mpi communicator from python to C. I chose to use boost's mpi communicator as mpi4py does not seem to have good C support. Check it out:

try: from boost.mpi import world
except ImportError: from mpi import world
err = run_with_mpi(infile, world, stdout, stderr, exc)

On systems where boost.mpi is installed, this raises no errors. However, boost.mpi cannot be installed on mac. I installed boost's module using homebrew's boost155 formula then added the .so file to pythonpath.

Generally, what does
Fatal Python error: PyThreadState_Get: no current thread
mean? What clues does this message give to developers like myself?

Full error message:

Fatal Python error: PyThreadState_Get: no current thread
[kilojoules-20160s:64471] *** Process received signal ***
[kilojoules-20160s:64471] Signal: Abort trap: 6 (6)
[kilojoules-20160s:64471] Signal code: (0)
[kilojoules-20160s:64471] *** End of error message ***

Answer Source

This problem may occur if the .so file from homebrew's formula links against a different python library than the interpreter you are running, see also this thread and this response.

If you have no other dependencies then running your program using the python interpreter from homebrew (which should be located in /usr/local/bin/) may solve the issue.