Error libtorch_python.so: cannot open shared object file: No such file or directory
My problem is solved. I'm uninstalling my torch twice
pip uninstall torch
pip uninstall torch
and then re-installing it back:
pip install torch==1.0.1.post2
Andira Gita
Updated on June 26, 2022Comments
-
Andira Gita almost 2 years
I'm trying to implement fastai pretrain language model and it requires torch to work. After run the code, I got some problem about the import torch._C
I run it on my linux, python 3.7.1, via pip: torch 1.0.1.post2, cuda V7.5.17. I'm getting this error:
Traceback (most recent call last): File "pretrain_lm.py", line 7, in <module> import fastai File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/__init__.py", line 1, in <module> from .basic_train import * File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/basic_train.py", line 2, in <module> from .torch_core import * File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/torch_core.py", line 2, in <module> from .imports.torch import * File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/imports/__init__.py", line 2, in <module> from .torch import * File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/imports/torch.py", line 1, in <module> import torch, torch.nn.functional as F File "/home/andira/anaconda3/lib/python3.7/site-packages/torch/__init__.py", line 84, in <module> from torch._C import * ImportError: libtorch_python.so: cannot open shared object file: No such file or directory
So I tried to run this line:
from torch._C import *
and got same result
ImportError: libtorch_python.so: cannot open shared object file: No such file or directory
I checked
/home/andira/anaconda3/lib/python3.7/site-packages/torch/lib
and there are onlylibcaffe2_gpu.so
andlibshm.so
file, and I can't find libtorch_python.so either. My question is, what is actually libtorch_python.so? I've read some of article and like most of it talked about undefined symbol, not cannot open shared object file: No such file or directory like mine. I'm new at python and torch so I really appreciate your answer. -
Ekho over 4 yearsI have been using TensorFlow for a while, but after the release of Detectron2, by FAIR, I decided to give it a go and also start getting my hands dirty with PyTorch. Very upsetting to find the same issue as you did and even more upset with the way it was fixed. Anyways, thanks for posting.
-
Abu Shoeb over 3 yearsThis is a lifesaver 🤓