Open imyourm8 opened 7 years ago
This command is failing:
from caffe2.python.caffe2_pybind11_state import *
That error can be fixed if you tweak your python bindings.
Look here: https://caffe2.ai/docs/getting-started.html?platform=mac&configuration=compile#python-configuration
And you'll probably need to use 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
Didnt help =(
sudo install_name_tool -change libpython2.7.dylib /usr/lib/libpython2.7.dylib /usr/local/caffe2/python/caffe2_pybind11_state.so
This is result of otool:
sudo otool -L /usr/local/caffe2/python/caffe2_pybind11_state.so
/usr/local/caffe2/python/caffe2_pybind11_state.so:
@rpath/libCaffe2_CPU.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/protobuf/lib/libprotobuf.13.dylib (compatibility version 14.0.0, current version 14.0.0)
/usr/local/opt/glog/lib/libglog.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/gflags/lib/libgflags.2.2.dylib (compatibility version 2.2.0, current version 2.2.0)
/usr/local/opt/opencv/lib/libopencv_highgui.2.4.dylib (compatibility version 2.4.0, current version 2.4.13)
/usr/local/opt/opencv/lib/libopencv_imgproc.2.4.dylib (compatibility version 2.4.0, current version 2.4.13)
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)
/usr/local/opt/opencv/lib/libopencv_core.2.4.dylib (compatibility version 2.4.0, current version 2.4.13)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)
I also ran into this same error. I've tried setting my LD_LIBRARY_PATH
, DYLD_LIBRARY_PATH
, using install_name_tool
and I'm still seeing
WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
WARNING:root:Debug message: No module named caffe2_pybind11_state_gpu
dlopen("caffe2/python/caffe2_pybind11_state.so", a);
Fatal Python error: PyThreadState_Get: no current thread
Hey I found the solution. I use pure python not anaconda or something else.
The cause of this problem is two versions existing in /usr/bin and /usr/local/bin
Luckily I got a whole new macbook. It only have one python 2.7.10 under /usr/bin and thus I didn't get this issue.
I have another macbook, which have two versions (2.7.13 under /usr/local/bin installed by brew)
The solution is to get rid of the 2.7.13 version. Then everything will be fine.
This is caused by linking a static version of libpython into ycmd's ycm_core.so. This leads to multiple copies of the python interpreter loaded when python loads ycmd_core.so and this messes up python's global state. The details aren't important.
The solution is that the version of Python linked and run against must be built with either --enable-shared or --enable-framework (on OS X). This is achieved as follows (NOTE: for Mac, replace --enable-shared with --enable-framework):
When building python from source: ./configure --enable-shared {options} When building python from pyenv: PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install {version}
Hi. I konw it's not directly related to your post however google index high this post, and i was going back and back here. If you deal with this problem with anaconda on windows What have helped me is upgrading python
activate myEnv
conda update python
This should have been fixed by https://github.com/pytorch/pytorch/commit/73f6715f4725a0723d8171d3131e09ac7abf0666 .
@ppwwyyxx thanks a lot for pointing out to proper fix! It saved me several hours or maybe few days.
Last few lines from verbose output:
My .bash_profile lines:
Python version:
This is some lines from crash report:
Compiled from sources without GPU support. Followed everything. Before i had python 2.6 and python 3 installed, i removed them. After that i rebuilt everything again. Still same error is produced. Thanks for advance.