Ordinal 191 not found when importing torch

Hi, i have this issue where when i import torch I get the error:

The ordinal 191 could not be located in the dynamic link library


Ive tried uninstalling anaconda and reinstalling, uninstalling pytorch and reinstalling…

Nothing seems to fix that and it happened over night it seems! PLEASE HELP!

1 Like

This seems to be a conda issue, at least that’s what searching for this error yields. Did you recently reinstall anaconda?
Could you create a new virtual environment and reinstall PyTorch, please?

Hey, thanks for your answer! I’ve tried making a new environment and same thing happened, something very weird is happening. Ive reinstalled anaconda and same thing… other packages are working only pytorch is giving me this error, here is a picture of the error:

And i get the pop up ordinal 191 could not be located. I’ve looked online and i can’t find any solution to this problem

Could you try to use some of the suggested workarounds from this issue?
Also, which conda and PyTorch version are you using?

Here is my anaconda info:

active environment : python
active env location : C:\Users\Public\anaconda3\envs\python
        shell level : 1
   user config file : C:\Users\Yann Majewski\.condarc

populated config files : C:\Users\Yann Majewski.condarc
conda version : 4.8.2
conda-build version : 3.18.11
python version : 3.7.6.final.0
virtual packages : __cuda=11.0

Im using the latest stable pytorch version 1.5. Is it possible there is a problem with compatibility?
I looked up the workarounds however it doesn’t really seem to be a similar problem. Im encountering this error only with pytorch. Its like it cant find the packages…

Hey @ptrblck I found the solution, there was a corrupted torch_cpu.dll file somewhere in one of the file probably from another install. Removing this copy allowed it to find the real torch_cpu.dll file and everything works now. Thank you for your time!

Hi @Yann_Majewski ,
I have the exact same issue. Would you mind telling me how you found that corrupted file please?

I found a workaround. I made a new venv with Python 3.8.3 and installed PyTorch again and all is working fine now.
p.s. I use pip and not anaconda (I hate anaconda! :slight_smile:)

1 Like

Hi @mahyar-osn,

Actually my problem wasnt even because of that file, i found that when i was downloading a sofware to open histoloy images it did something to my computer that corrupted some files or something like that. So uninstalling it solved my problem!

Best regards,