Error loading for Error loading "torch\lib\shm.dll after running the generated exe file

I have a pytorch program running successfully. Then I used the Pyinstaller to wrap us this python program into an exe file. This process was also finished successfully and generate d the related exe file. However, when I run this exe file, I got the following error message.

The program was developed under miniconda.

Python = 3.8.5
Pytorch = 1.11.0 -cpu version
Pyinstaller = 5.0.1

Traceback (most recent call last):
>   File "cli.py", line 8, in <module>
>   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
>   File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
>   File "scripts\integration_work\mdflag.py", line 20, in <module>
>   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
>   File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
>   File "torch\__init__.py", line 137, in <module>
> OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\u\AppData\Local\Temp\_MEI180242\torch\lib\shm.dll" or one of its dependencies.
> [4656] Failed to execute script 'cli' due to unhandled exception!
1 Like

Hello, have you solved this problem?

pip install intel-openmp

any news? I have the same problem here.

suggest to reinstall pytorch. install pytorch==2.2.2, torchvision==0.17.2, and torchaudio=2.2.2.