This is a summary of the installation errors with caffe2 and pytorch.
There are some problems when the binaries are copied to the final location. This causes that the sentence
$ python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
returns 'Failure' message when it is called out of the pytorch build folder.
If this is the case, open the terminal in any folder out of pytorch folder tree, and open the python console:
$ python
Then, try to import the core module of caffe2 with the sentence
from caffe2.python import core
This should print the error message related with the issue.
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_pybind11_state
If this is the case, the shared objects are missed in the final installation. So, go the pytorch build folder and copy the needed files in the installation folder with:
cp /home/user/git/pytorch/build/caffe2/python/caffe2_pybind11_state.so /home/user/anaconda3/envs/caffe2/lib/python2.7/site-packages/caffe2/python
cp /home/user/git/pytorch/build/caffe2/python/caffe2_pybind11_state_gpu.so /home/user/anaconda3/envs/caffe2/lib/python2.7/site-packages/caffe2/python