pytorch / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
https://pytorch.org
Other
82.54k stars 22.21k forks source link

[Caffe2] segmentation fault #8984

Open lrsoft17 opened 6 years ago

lrsoft17 commented 6 years ago

Hi,

I am following the installation guide for Caffe2 from https://caffe2.ai/docs/getting-started.html?platform=ubuntu&configuration=compile

When I get to the step where I have to test the Caffe2 install (by running cd ~ && python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"). I get failure.

I have run the command in the python interpreter, and I received the error 'no module named caffe2.python' - which I then fixed by adding the build directory to my PYTHONPATH environment variable.

I tried to run the test command again, which then gives me a segmentation fault. Any help would be appreciated.

~/pytorch/build/lib$ python Python 3.6.5 | packaged by conda-forge | (default, Apr 6 2018, 13:39:56) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux Type "help", "copyright", "credits" or "license" for more information.

from caffe2.python import core Segmentation fault (core dumped)

System Info

I am running a Google Compute machine, with a K80 GPU CUDA, CuDNN are installed so are all the dependencies for the Caffe2 installation. I am in a virtual environment in miniconda3

pjh5 commented 6 years ago

Do not add the build directory to your PYTHONPATH. Read https://caffe2.ai/docs/faq.html#why-do-i-get-import-errors-in-python-when-i-try-to-use-caffe2 and the following few questions to understand what should be in your PYTHONPATH.

In your cmake output (ctrl-f for "Summary") it tells you what the CMAKE_INSTALL_PREFIX is. This is the location where it installed Caffe2. If you use the python installation corresponding to that location (read the link above if you don't know what that means) then it should find Caffe2. If you want to install into a different python, then pass a different CMAKE_INSTALL_PREFIX to your cmake command.

Why are you not using scripts/build_anaconda.sh ? This script will handle common conda failure cases for you. If you really want to use cmake-make yourself with your Anaconda then you have to use https://caffe2.ai/docs/getting-started.html?platform=mac&configuration=compile#custom-anaconda-install or it will break with errors like these.