I am on a Windows 10 64 bit system. Pytorch for cuda has been working successfully for some time. Today I tried to upgrade to the latest version of Pytorch (1.13) using
OSError: [WinError 126] The specified module could not be found. Error loading “C:\Users\alan\anaconda3\lib\site-packages\torch\lib\caffe2_nvrtc.dll” or one of its dependencies.
I have tried both in a Jupyter notebook and in the Spyder IDE.
I have tried completely removing Anaconda and reinstalling afresh and then reinstalling Pytorch with no success. I do not believe I have any other versions of python installed.
The offending dll (caffe2_nvrtc.dll) does seem to be in the file location specified.
I have found various similar problems reported but they all date back to 2020 or earlier and none of them seemed to have a satisfactory solution.
Update. Although the system works the Jupyter kernel dies when using matplotlib.
after Googling I found that
import os
os.environ[“KMP_DUPLICATE_LIB_OK”]=“TRUE”
resolves the problem but there clearly is something wrong which I understand is multiple copies of OpenMP runtime is linked. I think this must be a Pytorch issue.
Today, I have updated CUDA from 11.8 to 12.1 and updated the cuDNN files from 11.x to 12.x and had the same issue with the latest stable build (1.13.1). Could fix it too with above mentioned solution using conda install -c anaconda cudatoolkit.
MS Win 10 Home, Version 10.0.19045 Build 19045
Python 3.9.13