Torchvision error: Could not find module image.pyd

visibility 2,822 comment 2 access_time 5 months ago languageEnglish timeline Stats
timeline Stats
Page index 19.86

Error context

I installed PyTorch in Anaconda with CUDA 10.2 as compute platform via the following command line:

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

The following error shows up:

 UserWarning: Failed to load image Python extension: Could not find module 'D:\conda\envs\py38\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}")

Fix this issue

There are two approaches to fix these two issues based on my research:

Approach 1 - use CUDA 11.3

Use the following command to use CUDA 11.3 as compute platform:

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

Approach 2 - rename image.pyd to

I have not verified this approach but found it from internet (Chinese).

*.pyd files are Python extension modules compiled from other languages like C.

This approach is to manually rename 'image.pyd' in torchvision package folder (for example, the path is  'D:\conda\envs\py38\Lib\site-packages\torchvision' in my computer) to ''.

Let me know if you can get it work.

info Last modified by Raymond 5 months ago copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

More from Kontext
Install Python 3.9.1 on WSL
visibility 2,446
thumb_up 1
access_time 5 months ago
Get Seconds, Minutes and Hours from datetime
visibility 68
thumb_up 1
access_time 6 months ago
Load JSON File into BigQuery
visibility 2,784
thumb_up 0
access_time 2 years ago
Load JSON File into BigQuery