ys7yoo / BrainCaffe2

Info on installing Caffe 2
0 stars 0 forks source link

[OSX] No module named 'caffe2.python.caffe2_pybind11_state' #8

Open ys7yoo opened 5 years ago

ys7yoo commented 5 years ago
MP4:pytorch yyoo$ export PYTHONPATH=`pwd`/build
MP4:pytorch yyoo$ python3 -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
Failure
MP4:pytorch yyoo$ python3
Python 3.5.6 (default, Oct  3 2018, 19:57:36) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from caffe2.python import core
WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
CRITICAL:root:Cannot load caffe2.python. Error: No module named 'caffe2.python.caffe2_pybind11_state'
ys7yoo commented 5 years ago

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

ys7yoo commented 5 years ago

caffe2_pybind11_state.cpython-35m-darwin.so is under [PYTORCH FOLDER]/build/caffe2/python

Maybe, I should add it to LD_LIBRARY_PATH

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Users/yyoo/src/pytorch/build/caffe2/python
ys7yoo commented 5 years ago

Needs some environment variables

export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/yyoo/src/pytorch/build/caffe2/python
ys7yoo commented 5 years ago

This does not work.

export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/
export DYLD_LIBRARY_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/caffe2/python:$DYLD_LIBRARY_PATH
ys7yoo commented 5 years ago

Trying re-build WITHOUT Intel MKL

NO_CUDA=1 NO_CUDNN=1 python3 setup.py build
elnazsn1988 commented 5 years ago

Were you able to solve the issue? I am facing a similar issue in that my system cannot find caffe2_pybind11 after succesful Caffe2 build. I downloaded and installed nccl2 as mentioned in another post, and after searching can only find pybind11 under a seperate subfolder, with no caffe2 prefix.