If you get stuck in Cannot load mkl_intel_thread.dll in Python on Windows

I don't know what the number is, but I got stuck with ʻIntel MKL Fatal ERROR: Cannot load mkl_intel_thread.dll` in Python (Anaconda / Miniconda) on Windows, and I investigated and solved it, so I summarized the best solution I think. Try.

1. First, check which dll is loaded

You can find out which dll is loaded by executing where.exe mkl_intel_thread.dll with Anaconda Prompt or Powershell.

> where.exe mkl_intel_thread.dll

C:\Miniconda3\envs\mkl_test\Library\bin\mkl_intel_thread.dll

#Note:When running in Powershell, be sure where, not where.exe !

If you see a dll that isn't installed by Anaconda or Miniconda, it definitely doesn't work with a ** version mismatch **, so either delete it or move it to another folder. (By the way, even if you manually put the latest version of MKL from Intel's site, you should delete it from the Path folder once. I got hooked here.)

If you do conda activate xxx, the display of where.exe will change, so if you are creating your own environment with conda, you should activate it first and then execute it.

2. If it doesn't work after organizing the dll, create a new environment.

If it doesn't work even if you delete the unnecessary dll and execute it again in step 1, it is better to create a new environment. For example, to create a new environment with Python 3.6.5: You can use any name you like for mkl_test.

conda create -n mkl_test python=3.6.5
conda activate mkl_test

# NOTE:The first time you activate with Powershell instead of Anaconda Prompt,
#   `conda init powershell`And you need to restart Powershell.

However, in this create, if you insert anaconda at the end as usual, the default numpy and scipy will be included, so you should not include it. ** Install MKL first, and then add the libraries you need from there **.

As for the MKL version, I didn't work in 2019.4, but in 2019.1 and 2018.0.3.

conda install mkl=2019.1

From here, add the necessary libraries.

conda install numpy scipy
conda install -c pytorch pytorch=0.4.1
#etc

And finally, check the dll with where.exe mkl_intel_thread.dll, and it is correct that only the dll under envs of the environment created this time is displayed.

> where.exe mkl_intel_thread.dll

C:\Miniconda3\envs\mkl_test\Library\bin\mkl_intel_thread.dll

If you run ʻimport numpy` etc. again in this state, it will probably work.

Recommended Posts

If you get stuck in Cannot load mkl_intel_thread.dll in Python on Windows
If you get stuck when building pycocoapi on Windows
What to do if you get a minus zero in Python
What to do if PyAudio cannot be installed on Python 3.7, 3.8, 3.9 on Windows
What to do if you get stuck during Anaconda installation on Linux
Python on Windows
Get keystrokes during background execution in Python (windows)
What to do if you get "Python not configured." Using PyDev in Eclipse
What to do if the Microsoft Store opens even if you run python on Windows
What to do if you get `No kernel for language python found` in Hydrogen
Until drawing a 3D graph in Python on windows10
If you get hooked on pip install dlib on OSX
What to do if you get an error when importing matplotlib in Python (Mac)
python basic on windows ②
BigQuery-If you get a Reason: responseTooLarge error in Python
If you encounter a "Unicode Decode Error" in Python
What to do if Python IntelliSense is not displayed in VS Code on Windows
Install python on windows
Get date in Python
What to do if Sort imports get stuck in VS Code's Python Extension (around 2020/09)
When you get an error in python scraping (requests)
What to do if you get Swagger-codegen in python and Import Error: No module named
Solution if the module is installed in Python but you get an error in Jupyter notebook
What to do if you get a Cannot retrieve metalink for repository error in yum
Until you create Python Virtualenv on Windows and launch Jupyter
Solution if you get 0xxx ascii coding error in superset
Why do you add a main ()-if statement in Python?
Let's get started with Python ~ Building an environment on Windows 10 ~
If you write TinderBot in Python, she can do it
What to do if you get "coverage unknown" in Coveralls
Automatically get the port where Arduino is stuck in Python
Print PDF in Python on Windows: Use an external application
Get YouTube Comments in Python
Set-enable Python virtualenv on Windows
Install watchdog on Windows + Python 3.3
Get last month in python
Python + Kivy development on Windows
Sphinx-autobuild (0.5.2) on Windows7, Python 3.5.1, Sphinx 1.3.5
Fastest Python installation on Windows
Build Python environment on Windows
Get Terminal size in Python
Explicitly get EOF in python
Build python environment on windows
I ran python on windows
Get Evernote notes in Python
[Python] [Chainer] [Windows] Install Chainer on Windows
Python install in 2 lines @Windows
Use Python on Windows (PyCharm)
Get Japanese synonyms in Python
Here are some grammars that you might get a slapstick face if you know it in Python
What to do if you get an error saying c compiler cannot create executables in configure
If you are having trouble with timeouts when implementing Slack's SlashCommand in Python on AWS Lambda
Create a Python environment for professionals in VS Code on Windows
How is the progress? Let's get on with the boom ?? in Python
If you get Error: That port is already in use. In Django
What to do if Python doesn't work on Git for Windows
python + SCOOP distributed computing cannot be done on a Windows PC
When I get an error with Pylint in Atom on Windows
I want to know if you install Python on Mac ・ Iroha
If you want to assign csv export to a variable in python
Check if you can connect to a TCP port in Python