Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

numpy import failed when both intel-numpy and numpy are installed

waizman__assaf
Beginner
1,140 Views

Hi,

 

I have a package which depends directly on intel-numpy==1.15.1 and transitively on numpy==1.16.3.

Dependency tree illustration:

my_package --> intel-numpy==1.15.1
           | 
           --> some-other-package --> numpy==1.16.3

when installing 'my_package' (inside a clean venv), both intel-numpy and numpy are installed. when trying to import numpy I get:

(venv) F:\envs\venv>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
Traceback (most recent call last):
  File "F:\envs\venv\lib\site-packages\numpy\core\__init__.py", line 40, in <module>
    from . import multiarray
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\envs\venv\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "F:\envs\venv\lib\site-packages\numpy\core\__init__.py", line 71, in <module>
    raise ImportError(msg)
ImportError:

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

Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using F:\envs\venv\Scripts\python.exe),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

     Note: this error has many possible causes, so please don't comment on
     an existing issue about this - open a new one instead.

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

 

I understand that having both intel-numpy and numpy installed causes the problem, but how can I avoid such a problem (without modifying 'some-other-package' to depend on intel-numpy too)?

Thanks.

 

My env:

- win10

- python 3.6.8

- venv (not using conda)

0 Kudos
1 Reply
Todd_T_Intel
Employee
1,139 Views

Hello,

If intel-numpy is installed first, pip should recognize that numpy is installed and not reinstall it. I think the problem is the version difference. Can "some-other-package" be built with numpy 1.15.1?

We are working on releasing numpy 1.16 to PyPI in the very near future, so if the other package does not work with numpy 1.15, you should have a compatible option with 1.16 soon.

Best, Todd

0 Kudos
Reply