Cannot import Pytorch in PyCharm

I use Windows 10 and PyCharm, but I can’t import Pytorch when running the code.
I used Anaconda to install Pytorch with this command:

conda install pytorch-cpu -c pytorch
pip install torchvision

Then, I configure the interpreter of my project, and the interpreter can see torch package. However. when I import torch in code, it shows the following error:

ImportError: DLL load failed: The specified module could not be found.

I can only import torch and run the code in Anaconda Prompt, but it failed in PyCharm. Please help me. Thanks.

It’s the admin rights issue you don’t have admin rights hence DLL load is failing

How to fix it? I run as admin but it still fails.

Right click on that folder see if it’s read only access box is checked ,uncheck

Sorry, that doesn’t help.

Please try this

1 Like