Error loading "\lib\site-packages\torch\lib\shm.dll" or one of its dependencie

I installed torch using “pip install torch” command. it was working.
I did install torchvision using “pip install torchvision” . after that started getting following error .
Error loading “\lib\site-packages\torch\lib\shm.dll” or one of its dependencies

Note: Uninstalled torch, torchvision and re-installed torch. still the issue persisted.

2 Likes

I have same issue (Windows 10, Cuda 12.1, Python 3.11).
Going back to Torch==2.2.2 fixed it for me, 2.3 failed.

1 Like

Following command solved the issue on my machine, I experianced the issue due to MKl version mismatch, latest torch installation getting me mkl which is interfering with mkl I have in my application.

python.exe -m pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cpu

1 Like

Hello, I tried as you wrote in your comment. Nothing worked, I tried installing different versions of Torch, Torchaudio, Torchvision. The error remains the same: …Python311\site-packages\torch\lib\shm.dll" or one of its dependencies. Please tell me the solution. Thanks in advance.

1 Like

i have the same issue today:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

I have cuda 12.1 on windows 11. is something broken on pytorch side?

Installing pytorch separately using the guide here fixed it for me

conda install pytorch torchvision torchaudio cpuonly -c pytorch

that looks like CPU only though. I need GPU support.

select options in following link for GPU support

Following on from @Alexander_DE’s reply, you should be able to resolve the issue by installing PyTorch2.2 instead of the current latest version 2.3.

The previous install commands can be found on: Previous PyTorch Versions | PyTorch

More information on debugging this issue can be found on this thread here: Cuda not available for RTX 6000 mobile - #9 by AlphaBetaGamma96

1 Like

Cross-posting also the GitHub issue tracking it.

2 Likes

Hello! I solved this problem. Add env path …\AppData\Roaming\Python\Library\bin\

its not working… also changing the version to torch==2.2.2 cant even show have cuda

help its not working as well

Thnaks, I solved it with your suggestion.

So I had this problem also, version 2.2.1 works, but version 2.3.0 does not.
Is this a bug that needs fixing? What is the root cause of this? I want to keep my packages updated and there are some dependencies that will require to keep up with the latest.

thanks after countless hours your suggestion worked

Faced the same issue.

Resolved it using:

pip install torch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0

2 Likes

Thnaks, I solved it with your suggestion

thank you, your method worked for me

Thank you dude for solving my 5 hrs issue. Hope you have a great time ahead.