{"id":14709,"library":"mkl-static","title":"Intel® oneAPI Math Kernel Library (MKL) Static","description":"mkl-static provides the static libraries for Intel® oneAPI Math Kernel Library (MKL). MKL is a highly optimized library of mathematical functions (BLAS, LAPACK, FFTs, etc.) essential for high-performance computing. It is primarily used as a backend for scientific Python libraries like NumPy and SciPy to deliver maximum performance, rather than being directly imported in Python. The current version is 2025.3.1, and it's maintained by Intel as part of their oneAPI ecosystem.","status":"active","version":"2025.3.1","language":"en","source_language":"en","source_url":"https://www.intel.com/content/www/us/en/developer/tools/oneapi/mkl.html","tags":["math","linear algebra","performance","blas","lapack","optimization","c-bindings"],"install":[{"cmd":"pip install mkl-static","lang":"bash","label":"Install mkl-static"}],"dependencies":[],"imports":[],"quickstart":{"code":"import numpy as np\n\nprint('NumPy version:', np.__version__)\nprint('NumPy configuration:\\n', np.__config__.show())\n\n# Expected output for MKL linkage will show 'mkl_info' or similar entries.","lang":"python","description":"mkl-static does not provide direct Python imports. Its quickstart involves demonstrating how a Python library, such as NumPy, is configured to use the MKL backend. This code snippet prints NumPy's configuration, which should show 'mkl_info' if it's correctly linked to MKL."},"warnings":[{"fix":"Do not attempt to `import mkl-static`. Instead, ensure your numerical Python libraries are built or configured to use MKL. Check `numpy.__config__.show()` to verify MKL linkage.","message":"The `mkl-static` package does NOT provide any direct Python imports or modules. It solely provides the underlying MKL binary libraries for other Python packages (like NumPy, SciPy, scikit-learn) to link against during their installation or at runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that if you intend to use MKL, your Python packages (e.g., NumPy, SciPy) are installed from sources that are built against MKL (e.g., conda-forge often provides MKL-enabled builds) or explicitly configured to link to the `mkl-static` binaries. The `mkl-service` package can sometimes help manage MKL threading.","message":"Incorrect MKL setup can lead to performance degradation or runtime errors if a library expects MKL but finds a different BLAS/LAPACK implementation, or none at all.","severity":"breaking","affected_versions":"All versions"},{"fix":"Use a dedicated virtual environment. If using Conda, let Conda manage MKL dependencies via `conda install numpy scipy mkl`. If using pip, ensure a consistent environment. Intel's `mkl-service` package provides utilities to manage MKL runtime behavior.","message":"Mixing `mkl-static` with other BLAS/LAPACK providers (like OpenBLAS or netlib LAPACK) or MKL versions in the same environment can lead to subtle bugs or crashes.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure `mkl-static` is installed. Check that relevant environment variables like `LD_LIBRARY_PATH` (Linux) or `DYLD_LIBRARY_PATH` (macOS) include the MKL library path, or use `conda install mkl-static` within a conda environment, which typically handles library paths automatically. Alternatively, explicitly link the dependent library against MKL.","cause":"The Python environment or the calling library (e.g., NumPy) expects MKL, but the MKL libraries are not found in the system's library paths or are incompatible.","error":"MKL FATAL ERROR: Cannot load libmkl_intel_thread.so or libmkl_intel_lp64.so."},{"fix":"Run `import numpy as np; np.__config__.show()`. Look for `mkl_info` to confirm MKL linkage. If absent, you might need to reinstall NumPy/SciPy from a source that explicitly builds against MKL (e.g., `conda install numpy scipy mkl` or using specific wheels that bundle MKL).","cause":"The Python package (e.g., NumPy) is not actually linked against MKL, even if `mkl-static` is present in the environment. It might be linked to a generic or different BLAS/LAPACK implementation.","error":"NumPy/SciPy performance is lower than expected, even with MKL installed."},{"fix":"Ensure that `mkl-static` (or another MKL provider) is correctly installed and its libraries are discoverable in your system's PATH (Windows) or LD_LIBRARY_PATH (Linux). If using Conda, `conda install mkl-service` usually resolves this by pulling in necessary MKL dependencies.","cause":"This error typically refers to the `mkl-service` package, not `mkl-static`. `mkl-service` provides Python bindings to control MKL. This error occurs when the MKL dynamic libraries are not found by `mkl-service`.","error":"ImportError: DLL load failed while importing _mkl_service: The specified module could not be found."}],"ecosystem":"pypi"}