Pytorch could not find module
I have installed pytorch with command:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch -y


Python complains regarding line import torch with message:

Could not find module 'C:\ProgramData\Anaconda3\envs\edx\lib\site-packages\torch\lib\caffe2_nvrtc.dll' (or one of its dependencies). Try using the full path with constructor syntax


This directory contains library caffe2_nvrtc.dll. What might be wrong and how to fix this error?

I faced the same problem. If your OS is Windows then I would recommend using Anaconda and installing pytorch in separate conda environment. Quick solution is to search for nvcuda.dll file on google and download this file. If you are running the code on Jupyter notebook the output will give you the complete path of the 'lib' folder of conda environment. By default it is 'C:\Users\YourUserName\anaconda3\envs\mera_beta\Lib\site-packages\torch\lib'. Go this directory and paste the file in this folder. Rerun your code. Hopefully it will run.
