Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6982 Discussions

Intel MKL distribution for Python is broken as of version 2024

Carlos_Souto
Beginner
1,026 Views

I am using Intel MKL directly from Python via ctypes.

I can import the Intel MKL runtime library via "mkl_rt = ctypes.CDLL(PATH_TO_MKL_RT_DLL)".

 

I installed the Intel MKL runtime library via pip, "pip install mkl".

The path to the "mkl_rt.2.dll" is:

PATH_TO_MKL_RT_DLL="C:\PathToPythonInstallation\Python\Library\bin\mkl_rt.2.dll"

Which is the path I use to import the mkl_rt.2.dll.

 

This has worked fine, however, since mkl 2024, I get the following exception when calling some of the Intel MKL functions:

"OSError: [WinError -1066598274] Windows Error 0xc06d007e"

 

I found two fixes:

1) To not upgrade to Intel MKL 2024, ie, installing "pip install mkl<2024"

2) To copy and paste "libiomp5md.dll" to the "Python\Library\bin\" directory (the same dir where pip installs the other DLLs like "mkl_rt.2.dll").

 

 

 

 

 

 

 

0 Kudos
3 Replies
George_Silva_Intel
964 Views

Thank you so much @Carlos_Souto 

 

We were able to reproduce the issue on latest Anaconda environment installing mkl 2024.0.0 on Windows, now we are analyzing the best solutions that seems to be related to changes to intel-openmp package. A support ticket was filled and we will get back to you as soon as possible.

 

Copying the dll file for now is a workaround until the Python packages are fixed. If you are using Anaconda , another workaround is to create an environment as follows (I tested for both versions 3.11 and 3.9):

> conda create -n newEnv python=3.11

Looks like Anaconda will install libiomp5md.dll as part of the environment creation and the error will not happen. Please let us know if you are using a different configuration or Python version.

 

Thank you again for reporting the issue!

0 Kudos
Carlos_Souto
Beginner
904 Views

Thank you for confirming this issue.

I use Python on Windows 11.

I generally use the latest version, in this case, Python 3.12.

I don't use Anaconda, just Python with few packages installed via pip (numpy, scipy, matplotlib, vtk, mkl).

 

0 Kudos
George_Silva_Intel
428 Views

Hello @Carlos_Souto 

 

Last March 22nd 2024 the intel-openmp-2024.0.3 release fix the Python issue and it the fix is also available in the latest minor release of intel-openmp (2024.1):

https://pypi.org/project/mkl/2024.1.0/

 

No more workarounds are need now, thank you so much for helping oneMKL for the developer community! 

Let us know if you have any question so we can close this topic.

Best regards,

__

George Silva

oneMKL Product Manager

0 Kudos
Reply