I have created a virtual environment using python -m venv .
I don’t have a Cuda GPU, so I selected the CPU option from the installation which was: pip3 install torch torchvision torchaudio
when I tried to import torch I got the below error:
(ali) C:\Users\pc\ali>python
Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
import torch
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\pc\ali\Lib\site-packages\torch_init_.py”, line 141, in
raise err
OSError: [WinError 126] The specified module could not be found. Error loading “C:\Users\pc\ali\Lib\site-packages\torch\lib\fbgemm.dll” or one of its dependencies.
So I did this: pip uninstall torch
and then tried from online resources the following: pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
and still the same problem happens.
It is probably worth mentioning, I checked that fbgemm.dll is actually there and so it is probably one of its dependencies that is missing. I tried viewing them (on my friends machine where the installation worked with no issues) in Dependency walker and here is the photo I found on his:
I had the same issue with fbgemm.dll when trying to run a ComfyUI session after following comflowy CLI procedure for installation, when invoking python main.py
Thank you for mentioning the idea of checking for fbgemm.dll with dedicated tool, this unlocked my situation but dependency walker dates back 2006, since then dll have changed and a more modern tool is required, found lucasg dependencies. This latest tool shows only one missing dependency to fbgemm.dll in my windows setup and that was libomp140.x86_64.dll
Since it is distributed with visual studio (not visual studio code) I installed visual studio community edition and libomp140.x86_64.dll was now put in both the visual studio program files and in C:\Windows\System32\ ie. in the Path. Now the ComfyUI main.py script runs fine on my system. Hope this helps.
Is that specific version required? coz i do have 14.40.33810 and same issue happens, i think libomp* is (no longer) shipped with it (?) and not very keen to downgrade it.
I did this, though I got the exact same error when trying to run the code again. Is this a foolproof method or might there have been something wrong that I did?