Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load image Python extension

Hello I am getting this error I tried different torch and torchvision versions and nothing worked. Any suggestion please?

env/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
warn(f"Failed to load image Python extension: {e}")

I tried different torch and torchvision versions

like image 928
Ranim Saidi Avatar asked Mar 13 '26 06:03

Ranim Saidi


1 Answers

Cause of problem

The versions of Pytorch and Torchvision do not correspond to the following link. According to your own situation, reload Torchvision and Pytorch.

Problem solving

  1. Enter your Anaconda environment and pip list. Show all our libraries. You can see here. For me, the torch was 1.11.0. According to the above link, the corresponding torchvision should be 0.12.0.
  2. pip3 uninstall torchvision.
  3. pip3 install torchvision==0.12.0. Specify the installation torchvision version of.
like image 83
Vincente Avatar answered Mar 14 '26 19:03

Vincente



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!