"C:\torch\lib\fbgemm.dll" or one of its dependencies
Asked Answered
P

4

4

OSError: [WinError 126] The specified module could not be found. Error loading "C:\apps\python\lib\site-packages\torch\lib\fbgemm.dll" or one of its dependencies.

System information:

Operating system: Windows 11 Python version: 3.15 PyTorch version: 2.3.0 I'm not sure what else to try to resolve this issue. Any help or suggestions would be greatly appreciated. Thank you!

I've tried reinstalling PyTorch using pip uninstall and pip install commands, but the issue persists. I've checked my system environment variables and ensured that the paths to Python

Protective answered 15/5 at 13:29 Comment(0)
S
6

I was able to resolve this issue and it was related to a missing dependency for:

libomp140.x86_64.dll

I was setting up a clean Windows 11 Pro system and wanted to get the latest and greatest Torch with Cuda 12.4 on there for development. Until I got exactly the error you are mentioning. I tried installing and reinstalling different versions of the C++ redistributables to no avail. I also installed Visual Studio Pro 2022. Nothing would get me that file.

Remedy: Get a copy of libomp140.x86_64.dll and put it in C:\Windows\Sytem32

After I did that, everything started working. For some reason, installing the newest VS and/or C++ redistributables will no longer put that file in there. I got mine from a (slightly) older install that had Visual Studio Pro on it. So, you may need to get it yourself until there is some kind of official fix. Disclaimer: I have no idea if this fix is safe or causes conflicts. Please note those here if you have issues.

Sunfish answered 25/7 at 17:36 Comment(2)
For those who cannot find this file, I put a copy of mine from an earlier VS2022 install on my site: mackenziemackenzie.com/downloadsSunfish
it worked for me...thanks a lotParyavi
R
4

I installed pythorch as follows and everything worked well. Installing with pip did not work.

conda install -c pytorch pytorch
Reporter answered 26/7 at 11:5 Comment(0)
O
2

I've tried several things, including getting the latest MS Visual C++ 2015-2022 Redistributable (x64) - it was the 14.40.33810 at this moment. I'm using CPU - not GPU, so I found an string to use to force the CPU installation of torch (and torchvision):

pip3 install torch==2.3.1+cpu torchvision==0.18.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

No special reason for that torch version, just wanted one compatible with CPU. The one for torchvision is compatible with torch.

Importing torch later worked.

Oligarchy answered 24/7 at 18:51 Comment(0)
C
1

Install through conda

torch torchvision torchaudio

Check this https://pytorch.org/get-started/locally/

Install it using conda according to your operating system

conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
conda install pytorch torchvision torchaudio cpuonly -c pytorch
Carpetbag answered 22/8 at 12:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.