Skip to content

numpy ImportError: DLL load failed: The specified module could not be found. #10628

@nitroamos

Description

@nitroamos

Is it possible to install numpy using pip/setup.py from within a conda environment?

Actual Behavior


C:\Users\AAnderson\cmder
λ conda create -n test8 python=3.6
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.12
  latest version: 4.6.3

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: c:\tools\Anaconda3\envs\test8

  added / updated specs:
    - python=3.6


The following NEW packages will be INSTALLED:

    certifi:        2018.11.29-py36_0
    pip:            19.0.1-py36_0
    python:         3.6.8-h9f7ef89_1
    setuptools:     40.7.3-py36_0
    sqlite:         3.26.0-he774522_0
    vc:             14.1-h0510ff6_4
    vs2015_runtime: 14.15.26706-h3a45250_0
    wheel:          0.32.3-py36_0
    wincertstore:   0.2-py36h7fe50ca_0

Proceed ([y]/n)?

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate test8
#
# To deactivate an active environment, use
#
#     $ conda deactivate


C:\Users\AAnderson\cmder
λ activate test8

C:\Users\AAnderson\cmder
(test8) λ pip install numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/b5/11/82916e23836a37c0d76babf74a7ca6f7b4fedd0814eaa166aacc2318b87c/numpy-1.16.1-cp36-cp36m-win_amd64.whl
Installing collected packages: numpy
Successfully installed numpy-1.16.1

C:\Users\AAnderson\cmder
(test8) λ python -c "import numpy"
Traceback (most recent call last):
  File "c:\tools\Anaconda3\envs\test8\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
  File "c:\tools\Anaconda3\envs\test8\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "c:\tools\Anaconda3\envs\test8\lib\site-packages\numpy\core\overrides.py", line 6, in <module>
    from numpy.core._multiarray_umath import (
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 "<string>", line 1, in <module>
  File "c:\tools\Anaconda3\envs\test8\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "c:\tools\Anaconda3\envs\test8\lib\site-packages\numpy\core\__init__.py", line 47, 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 c:\tools\Anaconda3\envs\test8\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.


C:\Users\AAnderson\cmder
(test8) λ echo %PATH%
c:\tools\Anaconda3\envs\test8;c:\tools\Anaconda3\envs\test8\Library\mingw-w64\bin;c:\tools\Anaconda3\envs\test8\Library\usr\bin;c:\tools\Anaconda3\envs\test8\Library\bin;c:\tools\Anaconda3\envs\test8\Scripts;c:\tools\Anaconda3\envs\test8\bin;C:\Users\AAnderson\cmder\bin;C:\Users\AAnderson\cmder\vendor\bin;C:\Users\AAnderson\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\AAnderson\cmder\vendor\conemu-maximus5;C:\Users\AAnderson\cmder\vendor\conemu-maximus5\ConEmu;c:\tools\Anaconda3\Scripts;c:\tools\Anaconda3\;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Python37\Scripts\;C:\Python37\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files\OpenSSL\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\AAnderson\AppData\Local\Microsoft\WindowsApps;C:\Users\AAnderson\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\AAnderson\AppData\Roaming\npm;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\AAnderson\cmder

Expected Behavior

Trying to install numpy into an anaconda environment (or use a package's python setup.py which has a numpy requirement)

Steps to Reproduce

This used to work on my machine (and I can still load its environment to test it and it's using numpy 1.16.1), but something seems to have changed and now I can't reproduce that (working) environment. I don't remember how I created that environment, but I don't think I did anything beyond python setup.py develop or similar.

I'm not very experienced with development on Windows, so I don't know much about how to debug dll issues.

I uninstalled anaconda this morning, and then reinstalled using chocolatey, but that didn't resolve the issue.

I get the same problem if I do this (i.e., without the python=3.6):

(test8) λ conda create -n test10
(test8) λ activate test10
(test10) λ python -c "import numpy"
...
ImportError: DLL load failed: The specified module could not be found.

and it also fails if I use python=3.7.
I also tried uninstalling numpy from the base environment but that didn't work.

although this does work:

C:\Users\AAnderson\cmder
(test10) λ activate base

C:\Users\AAnderson\cmder
(base) λ python -c "import numpy"

C:\Users\AAnderson\cmder

I also tried this:

(test12) λ conda create -n test13 python=3.6 numpy
(test12) λ activate test13
(test13) λ python -c "import numpy"
(test13) λ

and that worked too (although it gave me numpy 1.15.4 instead of 1.16.1, not that I care about which version).

Anaconda or Miniconda version:

4.5.12

This is what's provided by default from chocolatey right now. Last night I tried upgrading to the most recent anaconda and it had the same issue.

Operating System:

see below

conda info
C:\Users\AAnderson\cmder
(test8) λ conda info

     active environment : test8
    active env location : c:\tools\Anaconda3\envs\test8
            shell level : 1
       user config file : C:\Users\AAnderson\.condarc
 populated config files : C:\Users\AAnderson\.condarc
          conda version : 4.5.12
    conda-build version : 3.17.6
         python version : 3.7.1.final.0
       base environment : c:\tools\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/win-64
                          https://repo.anaconda.com/pkgs/pro/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : c:\tools\Anaconda3\pkgs
                          C:\Users\AAnderson\AppData\Local\conda\conda\pkgs
       envs directories : c:\tools\Anaconda3\envs
                          C:\Users\AAnderson\AppData\Local\conda\conda\envs
                          C:\Users\AAnderson\.conda\envs
               platform : win-64
             user-agent : conda/4.5.12 requests/2.21.0 CPython/3.7.1 Windows/10 Windows/10.0.17134
          administrator : False
             netrc file : None
           offline mode : False

conda list --show-channel-urls
C:\Users\AAnderson\cmder
(test8) λ conda list --show-channel-urls
# packages in environment at c:\tools\Anaconda3\envs\test8:
#
# Name                    Version                   Build  Channel
certifi                   2018.11.29               py36_0    defaults
numpy                     1.16.1                    <pip>
pip                       19.0.1                   py36_0    defaults
python                    3.6.8                h9f7ef89_1    defaults
setuptools                40.7.3                   py36_0    defaults
sqlite                    3.26.0               he774522_0    defaults
vc                        14.1                 h0510ff6_4    defaults
vs2015_runtime            14.15.26706          h3a45250_0    defaults
wheel                     0.32.3                   py36_0    defaults
wincertstore              0.2              py36h7fe50ca_0    defaults

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