'why is importing torchvision showing error the first time while it is getting imported smoothly when importing the second time?

Whenever I am importing torchvision, i am getting the error

>>> import torchvision

and the error i receive is

UserWarning: Failed to load image Python extension: Could not find module
'C:\Users\Aditya\anaconda3\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}")

but when i import it the second time it gets imported smoothly. I am impporting the facenet_pytorch library which implicitly imports torchvision. This is creating an error while importing facenet_pytorch. What to do next?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source