I’m trying to use both PyTorch and Caffe2 in a single project. To do so, I tried installing PyTorch from source (with the environment variable FULL_CAFFE2=1). This appeared to work fine. I then added pytorch/build to my PYTHONPATH.
The issue is that within a python session, I get a segmentation fault:
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from caffe2.python import workspace
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.python.caffe2_pybind11_state_hip'
Segmentation fault

Whereas if I import torch or import caffe2 first, I don’t see this error.
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> from caffe2.python import workspace
>>> 


Maybe I didn’t install caffe2 correctly with PyTorch? I’m on Ubuntu 16.04, CUDA 8, cuDNN v6.0.21.