Failed to load image Python extension: Could not find module

This also happens to me on on MacBook Pro M1 Pro using conda:

conda env create -n torch-issue python=3.10
conda activate torch-issue
conda install pytorch torchvision -c pytorch

It looks like the TorchVision installed package is not form the PyTorch source:

pytorch      2.0.1 py3.10_0            pytorch
torchvision 0.13.1 cpu_py310he5d19f7_0

Installing with the explicit source for TorchVision solves the issue:

conda install pytorch pytorch::torchvision -c pytorch
1 Like