Problem background

function yolov5 The following appears when warning, Although it does not affect the operation , But it looks bad . stay python Environment import torchvision
It is also the following problem , The description is that it cannot be loaded torchvision library .

/home/firefly/anaconda3/envs/yolo/lib/python3.8/site-packages/torchvision/io/image.py:13:
UserWarning: Failed to load image Python extension: warn(f"Failed to load
image Python extension: {e}")

Cause of problem

pytorch and torchvision The version of does not correspond to , The following figure is pytorch and torchvision The correct corresponding version of , Please according to your own situation , Reload pytorch Or reload torchvision.

Problem solving

1, Enter our anaconda environment ,pip list
Show all our libraries . You can see me here torch yes 1.11.0, According to the above table, the corresponding torchvision Should be 0.10.0, And I installed 0.12.0, So report an error .

2,pip3 uninstall torchvision uninstall torchvision.

3,pip3 install torchvision==0.10.0 Specify installation torchvision Version of .

We once again import torchvision, No error is reported , Successfully imported , Problem solving !

Technology