• Register
0 votes
261 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

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

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
1 answer 78 views
78 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 61 views
61 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, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 38 views
38 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
1 vote
1 answer 447 views
447 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, 2020 adamSw 11.3k points
1 vote
1 answer 79 views
79 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, 2020 adamSw 11.3k points
1 vote
1 answer 1.1K views
1.1K views
Problem: Hello there, I am using Python 3.5 in my Ubuntu 18.04 LTS based computer. I am trying to import a module named openpyxl in my script but somehow it&rsquo;s not happening for me. It says, module not found error: no module named 'openpyxl' Traceback ... the solution to this specific issue. Therefore, I come to this forum. Hopefully, you&rsquo;ll solve the problem and save my time. Thanks.
asked May 18, 2020 adamSw 11.3k points
1 vote
1 answer 94 views
94 views
Problem: Hello Kodlogs, Could any of you, please tell me what is module not found error: no module named 'quandl' error? I am trying to import the quandl module in Python-3.5.2 but it&rsquo;s not working in my case and produces an error. Here is the error I ... on my Ubuntu-based machine. Could you please find the error and give me a legit solution? I am looking forward to hearing for you. Thanks.
asked May 18, 2020 adamSw 11.3k points
0 votes
1 answer 14 views
14 views
I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below: gcc -Wall utilsmodule.c -o Utilc After executing the command, I get this error message: > utilsmodule.c:1:20: fatal error: ... solutions over the internet but the problem still exists. I have no problem with Python.h. I managed to locate the file on my machine.
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 4 views
4 views
Problem: I am trying to write a program for file transfer using sockets. The server end of the code is running fine. However, in the client side I get the following error Traceback (most recent call last): File "client.py", line 54, in <module> uploadFiles( ... usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 111] Connection refused
asked 1 day ago Mashhoodch 6.7k points
0 votes
1 answer 3 views
3 views
Problem: I'm trying to learn Python and am trying to execute a python file in terminal. I'm using 2.7.3 python version on my OS X. I've changed the directory in terminal to where the file is located, but I'm getting an error in terminal: >>> python ex1.py File "<stdin>", line 1 python ex1.py ^ SyntaxError: invalid syntax
asked 1 day ago Mashhoodch 6.7k points