Why do I get the error 'The ordinal 242 could not be located in the dynamic link library' when trying to import torch?
I am currently encountering some issues when trying to import PyTorch on my computer. I am working from my own local Windows laptop (which doesn't have any GPU) and installed Python 3.6 from python.org. I don't have the Anaconda distribution and usually install any new package by opening a Windows Command Prompt and using this command: pip install package.
Usually that's enough for me to be able to use the package right away (either via a Jupyter Notebook or by writing and running jupya .py script in Sublime Text). But PyTorch seem to be a little less straight forward.
I followed the installation instruction copied below (from the PyTorch website):

pip
No CUDA
To install PyTorch via pip, and do not have a CUDA-capable system or do not require CUDA, in the above selector, choose OS: Windows,
Package: Pip and CUDA: None. Then, run the command that is presented
to you.

I opened my Windows Command Prompt and simply ran this command:
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

The installation was successful and no error showed up during the process.
Now, when I open a Jupyter Notebook and run the command: import torch
I get the following error:
python.exe - Ordinal Not Found

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

c:\users\bdour\appdata\local\programs\python\python36\lib\site-packages\torch\lib\torch_cpu.dll

I checked and the torch_cpu.dll file DOES exist at the path mentioned in the error.
I tried to understand what that error meant but could not find much help. It seems like many people have issues with PyTorch, often due to some issues with their conda environment, but I am not using any environment. I am just trying to import and run the package locally.
And like I mentioned above, I usually encounter no problem with any other library when simply using a pip install command.
Does anyone know where that error is coming from and how to fix it?
Thank you in advance for your time and help.

I was actually able to find a solution on my own and thought I would post it here in case someone else struggled with the same error.
I found this helpful link and the suggested solution worked for me: https://kittaiwong.wordpress.com/2019/11/04/how-to-fix-the-ordinal-242-could-not-be-located-in-the-dynamic-link-library-mkl_intel_thread-dll/
In short, the problem seems to originate from a file named libiomp5md.dll present in the C:\Windows\System32 folder that is simply incompatible with numpy.
To fix it, I just looked for the file by copying and pasting it in Windows search, Opening file location (which should be C:\Windows\System32) and then renaming it to: libiomp5md.dll.bak
Now I can import torch without getting any error.
Hope that will help others who struggled with getting torch to run!
