• Register
0 votes
213 views

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

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

Then,

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:

https://github.com/facebookarchive/caffe2/issues/854

9 7 4
38,600 points
0 votes

Solution:

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
0 answers 2 views
2 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 7 minutes ago psandprop 520 points
0 votes
1 answer 26 views
26 views
Problem: I am very new to Keras. Now a days I am trying to use Keras (Sequential) but I am facing below error if 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- ... 2.0.3 and recently 'upgraded' to Pandas 0.20.1 which I doubt is causing a problem but above error message says nothing about it.
asked Jul 21 Raphael Pacheco 4.9k points
0 votes
1 answer 12 views
12 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 Raphael Pacheco 4.9k points
1 vote
1 answer 199 views
199 views
Problem: Hello good soul, I have recently come to know with python &ldquo;lxml&rdquo; module. I was willing to use this toolkit in my python script. Thus I wrote from lxml import etree ImportError: No module named lxml and got that above error. Then I ... the development packages of libxml2 and libxslt are installed ** What&rsquo;s wrong in my procedure? Could you please figure it out? Thanks.
asked May 18 adamSw 11.3k points
1 vote
1 answer 41 views
41 views
Problem: I am using a MacBook pro for my python development work. Right now I&rsquo;ve installed the nltk module on my machine by following a tutorial on YouTube. once I am trying to import the module in my script it&rsquo;s producing an error of: ImportError: No module ... . Do you know I am having this kind of error? Please, pull me up from this problem. I appriciate your concern Thanks, mate.
asked May 18 adamSw 11.3k points