Failed to load image Python extension: Could not find module

Check once using

pip check torchvision
pip check torch

I encountered the same problem, I am not using Cuda (running on Macbook M1 to test things).
Even when I run a basic script it happens:

import torch
import as io

ok = io.read_image("img.jpg")

torchvision version 0.10.0 (and on 0.11.2, I tried to see if a downgrade will fix it).
torch version is 1.10.1

Installed using pip

When I look at the Traceback it goes down to - op = torch._C._jit_get_operation(qualified_op_name) and then the error is thrown back up.

Would really appreciate the help


exactly the same situation as @liranbd1 here.

EDIT: using python 3.9.9 installed via pyenv
EDIT2: downgrading to torchvision 0.10.0 didnt help
EDIT3: installing from instead of brew/pyenv doesnt fix it either

This issue might be MAC-specific, as I couldn’t reproduce it on Linux and don’t have a MAC to test it, so feel free to create an issue on GitHub so that we could try to reproduce it.

I’m using windows and I encountered the same problem.
I’m using:

  • python: 3.9.7
  • torch: 1.10.1+cu102
  • torchvision: 0.11.2+cu102

I’ve upgraded CUDA to 11.1 and everything is fine now. Still strange the error in CUDA 10.2

1 Like

Hi. i have same problem too.

But i solved to downgrade torch and torchvision version.

My system is windows, and gtx 750ti using cuda 10.2.

I used

conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=10.2 -c pytorch

I think that latest version of pytorch isn’t match CUDA 10.2.

I hope that you solve this problem like this way.

I faced the same problem on my MBA@M1 and downgrading of the torch and torchvision helped me.

pip install --upgrade torch==1.9.0
pip install --upgrade torchvision==0.10.0


I also have the same problem. I got the following warning when I import torchvision

C:\ProgramData\Anaconda3\envs\torch1.10.1\lib\site-packages\torchvision\io\ UserWarning: Failed to load image Python extension: Could not find module 'C:\ProgramData\Anaconda3\envs\torch1.10.1\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
  warn(f"Failed to load image Python extension: {e}")

My system is Windows 10 with CUDA 10.2. Pytorch 1.10.1 was install in a conda environment with python 3.8 using the following command (from pytorch website)

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

When I call conda list, the following package shows up

torchvision               0.11.2               py38_cu102    pytorch
pytorch                    1.10.1               py3.8_cuda10.2_cudnn7_0    pytorch
pytorch-mutex             1.0                cuda    pytorch

Thank you for your help

Hi, I have the same problem.

import torch
import as io
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torchvision/io/ UserWarning: Failed to load image Python extension: 
  warn(f"Failed to load image Python extension: {e}")

My system is:
MacMini M1 macOS 12.1,
Python 3.9,
Pytorch 1.10.1,
torchvision 0.11.2

PyTorch and torchvision install by PIP.

1 Like

Thanks for helping man, I was trying to solve this issue for about an hour

1 Like

I followed suggestion by Maxim to resolve the issue!
I downgraded from pytorch-1.10.2 and torchvision-0.11.3 to pytorch-1.9.0 and torchvision-0.10.0
to resolve the error. Also, I am using pip in anaconda and the current pip dependency resolver doesn’t account for all the packages installed. I had to manually downgrade torchaudio to version 0.9.0 to avoid issues with it.
pip install --upgrade torch==1.9.0
pip install --upgrade torchvision==0.10.0
pip install --upgrade torchaudio==0.9.0


I had exactly the same specs as you. I solved this issue by creating a new environment in Anaconda and installing the following versions
conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1 -c pytorch


I am getting something similar:

UserWarning: Failed to load image Python extension: dlopen(/Users/anderson/Library/Caches/pypoetry/virtualenvs/redacted-cMHZGf73-py3.9/lib/python3.9/site-packages/torchvision/, 0x0006): Library not loaded: @rpath/libpng16.16.dylib
  Referenced from: /Users/anderson/Library/Caches/pypoetry/virtualenvs/redacted-cMHZGf73-py3.9/lib/python3.9/site-packages/torchvision/
  Reason: tried: '/Users/malfet/miniforge3/envs/py_39_torch-1.10.2/lib/libpng16.16.dylib' (no such file), '/Users/malfet/miniforge3/envs/py_39_torch-1.10.2/lib/libpng16.16.dylib' (no such file), '/Users/malfet/miniforge3/envs/py_39_torch-1.10.2/lib/libpng16.16.dylib' (no such file), '/Users/malfet/miniforge3/envs/py_39_torch-1.10.2/lib/libpng16.16.dylib' (no such file), '/usr/local/lib/libpng16.16.dylib' (no such file), '/usr/lib/libpng16.16.dylib' (no such file)
  warn(f"Failed to load image Python extension: {e}")

Seems like the file is not being included in torchvision-0.11.3-cp39-cp39-macosx_11_0_arm64.whl and we are not pointing to the right location anyway. I don’t have miniforge installed or a malfet user.

Hi Andersen!
I have 100% similar warning on MBP 14 m1 pro.
Do you know how to fix this warn? Internet doesn’t know same problems and I don’t know how to fix it.

Same here with Macbook 16" M1Pro and python 3.8.9

Getting the issue on Linux with torchvision nightly CPU (no CUDA) installed via:

conda install -c pytorch-nightly torchvision cpuonly

UserWarning: Failed to load image Python extension: /home/azureuser/miniconda3/envs/pytorch-0/lib/python3.9/site-packages/torchvision/ undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

Demangling the symbol name, it becomes torch::jit::parseSchemaOrName(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

Should I file a GitHub issue?

Hi Andrade, have you fixed it? I have the same problem.
There is a closed issue at where malfet said it has been resolved by 0.11.3, but I doubt that.
I create an issue at

I solved it by installing libpng and libjpeg with Homebrew and manually adding symlinks to /usr/local/lib.

I still think we should address this with a ticket since PyTorch packages are supposed to come with all dependencies included.

The same situation I encountered, I 'd like to wonder whether you have solved this error, plz.

Hope everything is fine on your side :slight_smile:
I just upgraded my CUDA from 10.2 to 11.1 and everything worked.