Skip to content

Fails to import on windows under non-conda-managed Python installs #137

@david-cortes-intel

Description

@david-cortes-intel

The intel python distribution has these instructions for windows:
https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-python-download.html?install-type=pip&python-pip=python-3_12&operatingsystem-pip=linux&packagetype-pip=idp-allcomponents
Image

If I pick a python installer for windows from https://www.python.org like this:
https://www.python.org/ftp/python/3.13.11/python-3.13.11-amd64.exe

And I do NOT check the box 'Add python.exe to PATH' (note that it is not checked by default), then after installing these intel python packages, numpy will fail to import, throwing an error (ImportError) about being unable to find DLLs for _multiarray_umath.

Before the error from python about not being able to load modules, I see a warning from mkl-service 'UserWarning: mkl-service failed to import ...'. Not sure if this package in particular is the culprit, but there is something wrong with the intel python packages related to numpy.

Full log:

>>> import numpy
C:\Users\david\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__init__.py:121: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init
Traceback (most recent call last):
  File "C:\Users\david\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\_core\__init__.py", line 22, in <module>
    from . import multiarray
  File "C:\Users\david\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\_core\multiarray.py", line 11, in <module>
    from . import _multiarray_umath, overrides
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\david\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__init__.py", line 124, in <module>
    from numpy.__config__ import show_config
  File "C:\Users\david\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__config__.py", line 4, in <module>
    from numpy._core._multiarray_umath import (
    ...<3 lines>...
    )
  File "C:\Users\david\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\_core\__init__.py", line 48, in <module>
    raise ImportError(msg) from exc
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.13 from "C:\Users\david\AppData\Local\Programs\Python\Python313\python.exe"
  * The NumPy version is: "2.3.2"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import numpy
  File "C:\Users\david\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__init__.py", line 129, in <module>
    raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions