Robotics StackExchange | Archived questions

Python segfaults on OS X.10 with Indigo and brew

Hello all,

I've installed ROS indigo, following the standard install on the site, on a Mac OS X 10 (Yosemite). Whenever I try to run python scripts such as rostopic or rosrun rqt_graph rqt_graph, I get the following error:

Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

I understand that this has something to do with conflicting python versions between Homebrew and Mac OS X. Is there anything I can do now, short of re-installing ROS again?

Thanks!

Asked by Michael on 2014-11-27 04:21:21 UTC

Comments

Having the same issue.

Asked by Tom Moore on 2014-11-27 09:21:13 UTC

Unfortunately I think you need to recompile everything, since all the packages which built against Python need to be built using the headers from the Python interpreter you're going to link against.

Asked by William on 2014-11-27 09:21:44 UTC

@William: I rebuilt everything just now, but am getting the same error. Do I need to do something with Python before recompiling? I tried doing a brew reinstall boost --with-python before building.

Asked by Tom Moore on 2014-11-27 10:38:22 UTC

@Tom Moore, I'm not sure, did you uninstall the Homebrew Python? or are you rebuilding because you now have the Homebrew Python?

Asked by William on 2014-12-02 08:36:21 UTC

I'm sorted now, thanks. I missed a step in the OS X instructions:

"Note: It is recommended to use the system python rather than homebrewed python because of problems with segmentation faults. http://answers.ros.org/question/108431/import-tf-segfaults-python-on-os-x-109-with-brewed-python/"

Asked by Tom Moore on 2014-12-02 10:26:30 UTC

Answers

In order to fix the problem, brew-python vs system-python, you can add the following options to catkin_make_isolated. This will tell CMake to link against brew-python.

-DPYTHON_INCLUDE_DIR="/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Headers"
-DPYTHON_LIBRARY="/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib"

Adjust the paths to match your version of python.

Asked by lubiluk on 2017-07-17 16:46:49 UTC

Comments