So my application uses easyocr and it has a dependency on pytorch. I’m getting the following error when I run my application as an exe.
OSError: [WinError 1114] A dynamic link library (DLL) initialization routine failed. Error loading "...\_internal\torch\lib\c10.dll" or one of its dependencies.
[PYI-15920:ERROR] Failed to execute script '...' due to unhandled exception!
Not seeing this error when I execute as a .py script. Tried many things but this issue is still occurring.
Torch version used: 2.9.0 cpu
Then I checked with torch version 2.8.0, it worked. Didn’t see the above issue. So I’m gonna go with that.
But I would like to know why I was facing this issue. Can someone explain it??
I also got the error message:
OSError: [WinError 1114] A dynamic link library (DLL) initialization routine failed. Error loading “…\_internal\torch\lib\c10.dll” or one of its dependencies.
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 works for me.
The issue could be if you are using PyQt. There seems to be a conflict with this package. There is a full thread with many solutions which could be found here (at the time of writing this, the issue is not closed)
Some of the solutions include: downgrading (to torch 2.8.0), pre loading a dynamic link library, importing torch before pyqt, Installing latest Microsoft visual C++