6

enter image description here I have been stuck with this problem for a while, and I would be very grateful if someone could help me resolve it. The system I am using is Ubuntu with CUDA 12.0.

As mentioned, I have tried uninstalling and reinstalling torchaudio, but I still encounter the same issue.

2
  • Check this github.com/pytorch/pytorch/issues/90673#issuecomment-1563799299 maybe it helps Commented Jul 28, 2023 at 7:52
  • 1
    @MarcelFerrari This leads to another error: OSError: libtorch_cuda_cpp.so: cannot open shared object file: No such file or directory. But cheers the error is different Commented Sep 13, 2023 at 2:15

2 Answers 2

0

Happened to me as well. If you installed pytorch with conda, it has some issues recognizing which build is the right one. I guess you have a cpu build, but have pytorch-conda installed and want to use it with the gpu.

To solve it either you run (create a fresh environment otherwise it might not work)

conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

as described on the pytorch webpage.

Or you can tell conda which build of pytorch you want to have exactly (here are all the builds available, you need one with *cuda* instead of *cpu*)

For example in my case

conda install pytorch=2.1.0=py3.11_cuda11.8_cudnn8.7.0_0 -c pytorch

solved the issue.

Sign up to request clarification or add additional context in comments.

Comments

0

I found this problem too and it happened when I wanted to download Torch again with a new version of torch. I was using some custom Cuda extensions with torch which had some custom setup installation with a setup.py. After upgrading torch and the Cuda version, I couldn't import this extension with the error:\

"OSError: libtorch_cuda.so: cannot open shared object file: No such file or directory

( I got some strange error like "cannot found libcudart.so.11" even though I was using pytorch with Cuda 12) \

By default, the setup.py advised by pytorch doesn't rebuild the cuda extension if the extension is already built even if the cuda compiler version of torch changed.\

So you should try to remove the build,.egg-info, and dist* folder of your extension and run its setup installation again and see if the error disappears.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.