December 22, 2024

HOW TO FIX DLL ERRORS (” Lib\site-packages\torch\lib\fbgemm.dll ” or one of its dependencies.) WHEN INSTALLING AND TESTING PYTORCH GPU/CPU IN A VIRTUAL ENVIRONMENT

In this tutorial, we explain how to fix the error


(env1) C:\codes\testPyTorch>python testPyTorch.py
Traceback (most recent call last):
  File "C:\codes\testPyTorch\testPyTorch.py", line 1, in <module>
    import torch
  File "C:\codes\testPyTorch\env1\Lib\site-packages\torch\__init__.py", line 148, in <module>
    raise err
OSError: [WinError 126] The specified module could not be found. Error loading "C:\codes\testPyTorch\env1\Lib\site-packages\torch\lib\fbgemm.dll" or one of its dependencies.

That appears during the Python command that imports PyTorch

import torch

The YouTube tutorial given below explains how to solve this problem.