Can't import in Python 3

Hello, is anyone have a solution for this issue?

Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.5/dist-packages/torch/init.py”, line 80, in
from torch._C import *
ImportError: /usr/local/lib/python3.5/dist-packages/torch/lib/libshm.so: undefined symbol: _ZTI24THRefcountedMapAllocator

I have tried to reinstall pytorch several times, but it doesn’t work.

How did you install PyTorch?
Did you use conda, pip or built from source?

I use pip3 to install pytorch.

Could you run

pip uinstall torch

a few times?
Probably there is an older version of libshm.so somewhere.

Have tried that, but the second try, it said torch isn’t installed so there is no need to uninstall.

Are you using virtual environments?
Could there be somehow another PyTorch installation?

maybe try looking for any places that this may exist:

sudo find / -name “libshm.so”

and delete any folders with torch.

Another option is to create a virtual env with conda. It works well. Here is a good guide. But basically, it’s three commands (after installing conda of course) - assuming you wanted python 3.6 and cuda 8:

conda create -n pytorch python=3.6
source activate pytorch
conda install pytorch torchvision cuda80 -c pytorch

and b/c it’s a virtual env it should not care about previous installations (in theory of course :laughing:)

For your information, I use default python3 from ubuntu and I try to avoid install anaconda because it will crash my other program (library installation and environment, need more time to adjust the library in anaconda python)
So based on your answer, the error is caused by last installation pytorch ?