'OSError: [WinError 127] The specified procedure could not be found. pytorch

I get this error OSError: [WinError 127] The specified procedure could not be found.

OSError                                   Traceback (most recent call last)
 in 
      5 import matplotlib.pyplot as plt
      6 
----> 7 import torch
      8 import torch.nn as nn
      9 import torch.optim as optim

~\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\__init__.py in 
     79     dlls = glob.glob(os.path.join(th_dll_path, '*.dll'))
     80     for dll in dlls:
---> 81         ctypes.CDLL(dll)
     82 
     83 

~\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    371 
    372         if handle is None:
--> 373             self._handle = _dlopen(self._name, mode)
    374         else:
    375             self._handle = handle

OSError: [WinError 127] La procédure spécifiée est introuvable

I installed pytorch a few days ago and hit this error for the first time today ... so I don't think it's an installation problem... I also tried to reinstall pytorch and still get this error I am using torch 1.5.1+cu101 and python 3.8.5 on windows 10 I have only one version of python installed. if someone could please help me on this thanks a lot



Solution 1:[1]

I got a similar error with Python 3.9.2 on Windows 10 and solved it doing the following:

I copied the CUDA 11 drivers (specifically cublas64_11.dll) from:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin to C:\<your python directory>\Lib\site-packages\torch\lib

Solution 2:[2]

I was having the same problem which was solved by uninstalling all the versions of python and venv and reinstalling only one.

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 richardec
Solution 2 Anil Kamat