• Register
0 votes

Problem :

 When I open python and enter import mapnik, the following error comes and python exits:
>>> import mapnik
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
6 5 3
6,930 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

I have faced the same problem between python27-apple and python27. 

I followed bellow steps and it worked for me:

sudo port select --list python


sudo port select python python27-apple

 To double check,

sudo port select --list python

And the python crash had gone when I ran the scripts.

Further Readings:


9 7 4
38,600 points
0 votes


This issue may happen in case the .so file from homebrew's formula links against a different python library than the interpreter you are running, view also this thread and this response.

In case you have no other dependencies then running your program employing the python interpreter from homebrew (which must be located in /usr/local/bin/) may solve the problem.

And you'll possibly require to employ the install_name_tool to point the library to the right python like this:

sudo install_name_tool -change libpython2.7.dylib ~/anaconda/lib/libpython2.7.dylib /usr/local/caffe2/python/caffe2_pybind11_state.so

This is occured by linking a static version of libpython into ycmd's ycm_core.so. This leads to multiple copies of the python interpreter loaded at the time python loads ycmd_core. Hence and this messes up python's global state. The details aren't significant.

The solution is that the version of Python linked and run against should be built with either --enable-shared or --enable-framework (on OS X). This is acquired as follows (NOTE: for Mac, replace --enable-shared with --enable-framework):

At the time building python from source: ./configure --enable-shared {options}
At the time building python from pyenv: PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install {version}

I got the cause: cmake-3.5 with GUI compile SimpleElastix by python-app which is a pre-installed version by OS-X, however the excute python in my command line is installed by homebrew or pyenv or macport or anything else. After failed employing otool -L and install_name_tool to switch dynmaic link library, i pursue this post to switch python by myself:

1.Delete old python version by OS-X:

sudo mv /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/2.7_bak
  1. Move the new python:

sudo mv /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/2.7

3.Setting group to wheel if required:

sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/2.7
  1.  4.  Updating the current link if required:

sudo rm /System/Library/Frameworks/Python.framework/Versions/Current sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/Current


10 6 4
31,120 points

Related questions

0 votes
1 answer 35 views
Problem: fatal error: openssl/opensslv.h: no such file or directory
asked Feb 18 charles mathews 5.5k points
0 votes
1 answer 202 views
Problem running homebrew as root is extremely dangerous and no longer supported.
asked Feb 9 charles mathews 5.5k points
0 votes
1 answer 364 views
I am trying to pip install the MySQL-python package, but I get an ImportError. Jans-MacBook-Pro:~ jan$ /Library/Frameworks/Python.framework/Versions/3.3/bin/pip-3.3 install MySQL-python Downloading/unpacking MySQL-python Running setup.py egg_info for package ... /T/pip-build/MySQL-python Storing complete log in /Users/jan/.pip/pip.log Jans-MacBook-Pro:~ jan$ Any ideas?
asked Oct 24, 2020 psandprop 2.4k points
0 votes
1 answer 13 views
Problem: I just installed the Requests module by using easy_install and I tried to run the demo code of tutorial, import requests payload = {'username': 'xxxx', 'password': 'xxxxx'} r = requests.get('https://github.com/timeline.json') but I get this error: AttributeError: 'module' object has no attribute 'get'How can I get away this?
asked Apr 19 Yeamin 22k points
0 votes
1 answer 110 views
Problem: I have recently started learning python. Now to do practical on python I am trying to install the python onto my homebrew. Python got downloaded and after that the error message popped up at the end of installation and it stopped it from completing. If I try to ... sudo chown -R $(whoami) /usr/local And nowI get the error message which reads as: chown: /usr/local: Operation not permitted
asked Jul 28, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 3 views
Problem: Does anyone have the skills to resolve this error? >Attributeerror: 'module' object has no attribute 'plot'.
asked 22 hours ago Danyal Sjoerd 6.8k points
0 votes
1 answer 4 views
Problem: Where ought to I seek an answer? >Attributeerror: module 'cv2.cv2' has no attribute 'face'.
asked 1 day ago Ashok Dileep 5.3k points
1 vote
1 answer 12 views
Problem: I am using strptime and facing this issue: Attributeerror: 'module' object has no attribute 'strptime'.
asked May 1 PkGuy 23.5k points
0 votes
1 answer 6 views
Problem: I am trying to use Keras (Sequential) but I get the following error when I try to import it: File "kaggle_titanic_keras.py", line 3, in <module> from keras.models import Sequential File "/anaconda/lib/python2.7/site-packages/keras/__init__.py", line 4, in ... .0.3 and 'upgraded' to Pandas 0.20.1 yesterday which I suspect is causing the problem but the error message says nothing about it.
asked Apr 26 anika11 32.2k points
0 votes
1 answer 8 views
Question: Here is my Transaction class: class Transaction(object): def __init__(self, company, num, price, date, is_buy): self.company = company self.num = num self.price = price self.date = datetime.strptime(date, "%Y-%m-%d") self.is_buy = is_buy And when I'm ... self.date = datetime.strptime(self.d, "%Y-%m-%d") AttributeError: 'module' object has no attribute 'strptime' How can I fix that?
asked Apr 15 munim01 21k points