Intel mkl fatal error

Pyinstaller numpy «Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll»

I’m new with python apps. I’m trying to build my python GUI app with pyinstaller. My app depends on the following packages: PyQt4, numpy, pyqtgraph, h5py. I’m working with WinPython-32bit-3.4.4.1.

I build the app with this command:

I launch my app with the exe file in the dist directory created by pyinstaller and it seems work fine until the program call numpy and crash with this error:

Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll

The mkl_intel_thread.dll is not present in the software directory; but with the file copied in the root dir of the program I got the same error

Thanks for your help

9 Answers 9

I had the same issue using Pyinstaller and Numpy. By default pyinstaller seems to not take into account numpy binaries so you have to specify it manually. You can add the files editing the «.spec» file «binaries» variable, but that will only work for your current program. If you want it working for all the programs your freeze you should make a «hook» and save it in C:\Python3*\Lib\site-packages\PyInstaller\hooks.

I had to adapt LeonidR’s code to make the numpy-hook working. I rewrited it using a more modern, pythonic approach using list comprehensions:

«Binaries» is a list of tuples. The second item of the tuple corresponds to the folder where you want to place the ‘dlls’. In this case is empty so it copies them directly in the main folder where your ‘.exe’ is.

I just ran into the same problem. As a workaround I copied the DLL’s manually, as described in https://stackoverflow.com/a/34893933/4089081

I’m trying to find a better solution though.

I created a hook-numpy.py to deal with this problem:

In my case, conda is installing the mkl libraries to speed up numpy and scipy .

j4n7‘s answer was very helpful, however, it may or may not be buggy. compat.base_prefix uses backslashes (at least for me) but they then concatenate with «/Lib/site-packages/numpy/core» (forward slashes).

As you can see, it produces both forward and backward slashes in a path.

Here are my steps that allowed me to bundle the numpy mkl files into onefile. Note that my particular app uses matplotlib and the problem I was experiencing was everytime I clicked a button (tkinter) to execute the plot, the app crashed.

Steps

First: Make a build of your app using:

Second: Open the .spec file and add this to it. Obviously make sure the below files actually exist first. You may not have Python34 so just a friendly warning not to copy blindly.

Читайте также:  Houdini dso error redshift

Third: where it says binaries=None , change to binaries=mkl_dlls .

Fourth: Re-run the first step. When your app is built, go into the dist folder and launch your app. I hope it works for you!

Источник

Cannot load mkl_intel_thread.dll on python executable

I’m trying to create an executable python program that runs on windows without python being installed, for this I’m using cx_Freeze. But I get the following error: «Cannot load mkl_intel_thread.dll»

On my PC, which has python installed (miniconda3), I built the executable using cx_Freeze, and when I ran the executable I also would get «Cannot load mkl_intel_thread.dll». I fixed this by going to my python folder, Library\bin, and copied the mkl_intel_thread.dll file to where the executable is placed. The problem is, when moving the whole folder to another PC (without python installed), this error reappears, even though the mkl_intel_thread.dll is in the folder.

File that I want to distribute (plot.py):

cx_Freeze setup file (setup.py):

4 Answers 4

Try to copy all files starting with mkl you find under Library\bin or numpy\core into the build folder, as well as libiomp5md.dll , see Python Pyinstaller 3.1 Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll and cx_freeze converted GUI-app (tkinter) crashes after pressing plot-Button.

Once you have found out which file(s) need(s) to be manually copied, you can let cx_Freeze include the necessary file(s) by using the include_files list of the build_exe options (see code snippet below). If necessary, you can use a tuple (source, destination) as item in the include_files list to let cx_Freeze copy a file from source to a specific destination into the build directory, see the cx_Freeze documentation.

I see further potential problems in the setup script you’ve posted in your question:

  • include the whole numpy packages using the packages list of the build_exe options, it is easier and maybe safer
  • it is safer to dynamically find out the location of the TCL/TK DLLs
  • for cx_Freeze 5.1.1, the TCL/TK DLLs need to be included in a lib subdirectory of the build directory

In summary, try t o use

in your setup script.

A similar issue affects cx_Freeze 6.1 or 6.2: the executable does not launch, either without error message or with

INTEL MKL ERROR: The specified module could not be found. mkl_intel_thread.dll.
Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

  • Windows 10
  • Python 3.8.5 installed from https://www.python.org/
  • numpy 1.19.1+mkl installed with pip using wheel from https://www.lfd.uci.edu/

gohlke/pythonlibs/

  • various python modules installed using pip
  • This is also observed with Python 3.6.8 or earlier versions of numpy such as e.g. 1.18.4+mkl or 1.19.0+mkl.

    I’ve observed that cx_Freeze includes 3 DLLs mkl_rt.dll , python38.dll , and vcruntime140.dll in the subdirectory lib\numpy\core of the build directory, whereas the original installation does not contain any DLL in the subdirectory site-packages\numpy\core (all DLLs are in site-packages\numpy\DLLs ). If I manually remove mkl_rt.dll from the subdirectory lib\numpy\core of the build directory after building the application with cx_Freeze, the issue disappears and the application works.

    This solution can be implemented by adding the following code at the end of the setup.py script:

    where dist_dir is the build directory generated by cx_Freeze (passed to the build_exe option).

    Источник

    Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll

    But now I have a subtle difference. I want to run the program without installing anaconda, just within a cmd.exe terminal, but it seems I am doing something wrong or that it is not possible.

    After generating my application with python setup.py bdist_msi using cx-freeze , I am able to install and then run it within an anaconda environment, but if I simply open a cmd.exe terminal and run it, I get

    However, when running

    the dll is found, so I think this means it’s registered in the system (I am more used to use Linux, so may be I am wrong).

    How could I solve this problem?

    5 Answers 5

    Maybe another DLL necessary for MKL, such as libiomp5md.dll for example, is missing and causes the error. See Cannot load mkl_intel_thread.dll on python executable, my answer there and its comments.

    If this still does not solve your problem, try to manually copy other DLLs from the anaconda environment’s library path into the app installation directory and its lib subdirectory. Once you have found which dependency is missing, you can use the include_files option of cx_Freeze to automatize this step in the setup (as you know).

    Another possible issue would be that you have an incompatible version of MKL installed on your system and that the frozen application finds this wrong one, but this is unlikely unless you have a 32-bit Python installation on a 64-bit system or have installed the application on another system.

    Источник

    mxnet build with intel mkl always throw error «Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.»

    Building mxnet 1.3.1(mxnet1.4.0 has bugs, can’t build it under windows,please check14203 for more details).

    I can build the mxnet with cpp-package, but when I call the forward function o the Executor, it keep throwing

    Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

    Following are my steps to build the mxnet

    1. git clone —recursive https://github.com/apache/incubator-mxnet mxnet
    2. cd mxnet
    3. Download intel mkl(w_mkl_2019.2.190.exe)
    4. install it
    5. open cmake3.11.0

    • I disable cpp_package,opencv,cuda,USE_MKLML_MKL(else mshadow will use openBLAS).
    • I disable USE_TENSORRT and USE_VTUNE too

    press configure,disable BUILD_TESTING

  • press configure again, all green
  • press generate,all green
  • open ALL_BUILD.vcxproj
  • Select Release build
  • All build
  • All green, except install project fail
  • >file cannot create directory: C:/Program Files/mxnet/lib. Maybe need 1> administrative privileges.

    Already open vc as admin, still the same error

    1. Add Anaconda3 into PATH
    2. Add libmxnet.dll and C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl\mkl_rt.dll into a folder which could be found by the os
    3. select build with cpp_package from cmake gui
    4. configure->generate
    5. reopen ALL_BUILD.vcxproj
    6. Select ALL_BUILD->build
    7. Because install do not work,I copy the files lib to build_cpu/install

    1. Because lrs and wds of op.h do not declare type,I need to add mx_float for them
    2. write a simple program, can compile
    3. When I call forward of the Executor,the program throw Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
    4. Add C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl的mkl_intel_thread.dll into the folder could be found by the os 26.Run again,still the same error Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

    My Anaconda3 install mxnet,it got mkl_intel_thread.dll and mkl_rt.dll too,I wonder there are confliction,problem is I did not add the bin path of Anaconda3 into the PATH.

    I tried to copy different mkl_intel_thread.dll and mkl_rt.dll into the folder where the exe at, but every combination of them give me same error.

    Those dll come from following path

    • C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl
    • C:\Users\yyyy\Anaconda3\envs\gluon\Library\bin
    • C:\Users\yyyy\Anaconda3\Library\bin
    • C:\Users\yyyy\Anaconda3\pkgs\mkl-2019.1-144\Library\bin

    Do anyone know how to solve this issue?Thanks

    Источник

    Python Pyinstaller 3.1 Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll

    Hello fellow programmers, so I am having a spot of trouble getting this python .exe to function properly. I am using Anaconda 3 and the latest version of pyinstaller, and my code has nothing odd going on when I run it as a .py, but for the sake of distribution I need to have it as a «.exe». Whenever I try to run my .exe all I get is the error:

    Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

    and then it closes. Again, I am not having this problem if I run my python code in .py format from the same command window.

    Any help would be greatly appreciated, thank you!

    1 Answer 1

    The error means that the program couldn’t find mkl library files under its library path, which is what you need to make it find.

    I had the issue when running matplotlib scripts on windows with numpy+mkl, and I got it fixed by copying files that start with «mkl_» in site-packages/numpy/core to my python.exe root.

    I’m not familiar with compiled python program but the idea should be the same. Since you had this error I assume you are using mkl version packages. You need to figure out where the .exe tries to load libraries from(could be the same path where the executable is located), and copy all the mkl dll’s of any package there. Or there could be something like «compile options» that allows you to configure the path etc.

    Источник

    Smartadm.ru
    Adblock
    detector