I installed PyTorch from source using the latest githu repo. When I tryied to import torch, I get the following
lex@lex:~/Documents/NNs/pytorch$ python -c "import torch"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "torch/__init__.py", line 53, in <module>
from torch._C import *
ImportError: No module named _C
There is a _C.so module in the /usr/local/lib/python2.7/dist-packages/torch/ path. DOes anyone know why this is giving me this error?
I never did. It always gives that error when I install from source. I have noticed that conda installs don’t do this. I wonder why this is so.
lex@lex:~/Documents$ /usr/bin/python -c "import torch"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/torch/__init__.py", line 53, in <module>
from torch._C import *
ImportError: /usr/local/lib/python2.7/dist-packages/torch/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/local/lib/python2.7/dist-packages/torch/lib/libTH.so.1)
lex@lex:~/Documents$
Here is a working solution for this problem when you install from source from varunagrawal:
"
I recently encountered this exact problem when compiling from source. A clean install also didn’t help. What worked was removing the libgomp.so.1 library from the torch directory and instead sym-linking it to the one in /usr/lib.