Closed alvations closed 7 years ago
Fatal Python error: PyThreadState_Get: no current thread
It seems that there are more than one Python installed according to https://stackoverflow.com/questions/15678153/homebrew-python-on-mac-os-x-10-8-fatal-python-error-pythreadstate-get-no-cu . @gangliao Could you help to have a look?
@alvations If there exists multiple Python in your system, when you compile the source code, please specify the appropriate python.
For example
cmake ~/Paddle -DPYTHON_EXECUTABLE=(which python)\
-DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -DWITH_TESTING=OFF -DWITH_STYLE_CHECK=OFF -DWITH_SWIG_PY=ON -DWITH_PYTHON=ON -DCMAKE_BUILD_TYPE=Release -DTHIRD_PARTY_PATH=/Users/baidu/.cache/third_party
Thanks @gangliao! The -DPYTHON_EXECUTABLE
and -DPYTHON_LIBRARY
parameters works. Now the paddle.v2
imports without the fatal error.
Small syntax difference to the command, using (which python)
, didn't work I need the to evaluate the command with $(which python)
:
cmake ~/Paddle -DPYTHON_EXECUTABLE=$(which python)\
-DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib \
-DWITH_TESTING=OFF -DWITH_STYLE_CHECK=OFF \
-DWITH_SWIG_PY=ON -DWITH_PYTHON=ON -DCMAKE_BUILD_TYPE=Release \
-DTHIRD_PARTY_PATH=/Users/baidu/.cache/third_party
When using the
paddle.v2
API, it threw a Fatal Python error:The detailed debug log from Apple:
I've installed Paddle from source on a MacOSX:
Installing the Python API: