Repository navigation
Closed
Description
Create fresh virtual env with Anaconda Navigator 1.9.6 under Windows 10, selecting Python 3.7, naming python37
In the console of VSCode:
- activate python37
- pip install numpy
(python37) D:\TfsProj\alphastone>pip install numpy
Collecting numpy
Using cached https://files.pythonhosted.org/packages/41/b8/3a6b07352c2542ca1c89be7583e7ca07bf513895b6ac59ae008054f326b1/numpy-1.16.1-cp37-cp37m-win_amd64.whl
Installing collected packages: numpy
Successfully installed numpy-1.16.1
(same with parameter --no-cache-dir)
- python
- import numpy
(python37) D:\TfsProj\alphastone>python
Python 3.7.2 (default, Feb 11 2019, 14:11:50) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "C:\Users\Name\.conda\envs\python37\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
File "C:\Users\Name\.conda\envs\python37\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File "C:\Users\Name\.conda\envs\python37\lib\site-packages\numpy\core\overrides.py", line 6, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Name\.conda\envs\python37\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\Name\.conda\envs\python37\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!
All advices, reinstallations via pip and conda, or different numpy versions (e.g. 1.15.4) didn't solve this issue for me.
If I do multiple pip uninstall numpy until there is no numpy left, and then do a conda install numpy, importing numpy interestingly works (in 1.15.4).
A conda install numpy does the following:
The following NEW packages will be INSTALLED:
blas pkgs/main/win-64::blas-1.0-mkl
icc_rt pkgs/main/win-64::icc_rt-2019.0.0-h0cc432a_1
intel-openmp pkgs/main/win-64::intel-openmp-2019.1-144
mkl pkgs/main/win-64::mkl-2019.1-144
mkl_fft pkgs/main/win-64::mkl_fft-1.0.10-py37h14836fe_0
mkl_random pkgs/main/win-64::mkl_random-1.0.2-py37h343c172_0
numpy pkgs/main/win-64::numpy-1.15.4-py37h19fb1c0_0
numpy-base pkgs/main/win-64::numpy-base-1.15.4-py37hc3f5095_0
What's missing for the pip way?
Any ideas?
Reacted by Joseph S., Hao Zhou, Viktor Makoviichuk, Florian Frey, i3v and Shivram Sambhus
Activity
mattip commentedon Feb 12, 2019
There is a difference between the location of the extra support libraries supplied with anaconda and those supplied with stock numpy that you get from
pip install. This requires adjustments to thePATHvariable. Perhaps thePATHadjustments are failing at import. Does thesite-packages\numpy\.libsdirectory exist and does it contain*.dllfiles?, If so, can you try to prepend that directory to yourPATHbefore running python:Please report back to us if that directory exists and if changing the path succeeds, it indicates the code in
numpy\__config__.pyis failing to modify theos.environ['PATH']. Maybe you have exceeded the allowedPATHlength, or there is some other problem with yourPATHenvironment variable.Details
Anaconda places the extra dlls in
<anaconda install>\Library\bin, and adds that directory to the path when you activate a anaconda environment. Stock numpy, as described above, tries to append the.libdirectory to the end of thePATHvariable.djdookie commentedon Feb 12, 2019
You method indeed works!
C:\Users\Name.conda\envs\test37\Lib\site-packages\numpy.libs exists and there is one file in it:
libopenblas.IPBC74C7KURV7CB2PKT5Z5FNR3SIBV4J.gfortran-win_amd64.dll
I will try a fresh install with a shorter initial path to verify your theroy in about an hour.
Side question: Shouldn't there be more dlls in that path? I want to use OpenMP and mkl with pytorch, not openblas...
mattip commentedon Feb 12, 2019
If you want to use mkl, then use conda, not pip
mattip commentedon Feb 12, 2019
sorry, use
pip install intel-numpynotpip install numpy, but you will get numpy 1.15.1. Conda makes it easier, and it seems you are using anaconda, so probably sticking with conda will give you a more unified experience.djdookie commentedon Feb 12, 2019
Ok I shortened my PATH and it's still not working with "pip install numpy".
This is prepended to my PATH if I "conda activate test37":
PATH=C:\Users\Name.conda\envs\test37;C:\Users\Name.conda\envs\test37\Library\mingw-w64\bin;C:\Users\Name.conda\envs\test37\Library\usr\bin;C:\Users\Name.conda\envs\test37\Library\bin;C:\Users\Name.conda\envs\test37\Scripts;C:\Users\Name.conda\envs\test37\bin;...
My PATH is still long, but I can't remove anything from it anymore, because other tools need it like it is.
Why is there no conda numpy 1.16.1?
Thanks for your help, mate!
djdookie commentedon Feb 12, 2019
(test37) D:\test>pip install intel-numpy
"conda install numpy" gives me 1.15.4 which is working fine.
indramal commentedon Feb 13, 2019
@mattip THANK YOU VERY MUCH
mattip commentedon Feb 13, 2019
Maybe we should statically link and alleviate the need for this path mangling
djdookie commentedon Feb 13, 2019
Could this PATH editing issue in numpy for newer python versions have the same reason?
pytorch/pytorch#4518 (comment) -> pytorch/pytorch#17051
ivarstange commentedon Feb 14, 2019
I got the same type of error for scipy as well. After creating an env using conda I had to uninstall using pip and install using conda for all packages that created an issue for me. That worked for me, although it's not an ideal solution since this was a very manual operation.
mattip commentedon Feb 14, 2019
@djdookie: just to be sure what worked and what didn't. You have the dll in
C:\Users\Name.conda\envs\test37\Lib\site-packages\numpy.libs. Prepending that to PATH before starting python worked. Could you try appending that to the end of PATH (with a ';' seperator) and testing if a pip-installed numpy works (maybe in a new conda environment, which would change the path)?Edit: note that the new environment would have a different path-to-dll
mattip commentedon Feb 14, 2019
It seems this is a broken ananconda, see this issue ContinuumIO/anaconda-issues#10628
mattip commentedon Mar 6, 2019
Closing. Anaconda seems to have fixed the issue that caused this.
isaacgerg commentedon Apr 25, 2019
I just downloaded the newest windows version of conda for python3.7 for windows 7 and got this issue. Can we reopen?
isaacgerg commentedon Apr 25, 2019
I solve the problem. It was a path issue as I was using WingIDE. I used these instructions to fix
https://wingware.com/blog/anaconda
Specifically, I opened the anaconda command prompt and did "PATH" and copied it into my wing path for my project.
For reference, my PATH=C:\Users\xx\AppData\Local\Continuum\anaconda3;C:\Users\xx\AppData\Local\Continuum\anaconda3\Library\mingw-w64\bin;C:\Users\xx\AppData\Local\Continuum\anaconda3\Library\usr\bin;C:\Users\xx\AppData\Local\Continuum\anaconda3\Library\bin;C:\Users\xx\AppData\Local\Continuum\anaconda3\Scripts;C:\Users\xx\AppData\Local\Continuum\anaconda3\bin;C:\Users\xx\AppData\Local\Continuum\anaconda3\condabin;
Akababa commentedon Sep 28, 2019
I just went to the folder and deleted one. That seems to have fixed it.
jeffheaton commentedon Dec 15, 2019
This also seems to happen in Jupyter if you do not "conda activate" the environment that you will be using PRIOR to starting Jupyter.
mKay00 commentedon Dec 18, 2019
And it also happens in VS Code if you don't "conda activate" the environment PRIOR to starting vs code. If I use "code ." in the conda environment prompt, it works.
opokualbert commentedon Jan 20, 2020
This worked for me. And the issue seems to particularly in jupyter lab
TimoRiikonen commentedon Apr 3, 2020
I solved my issues with Numpy DLL load issues by replacing Anaconda3 with WinPython.
stlweb commentedon May 7, 2020
I have this issue with WinPaython
ShaikhaTheGreen commentedon Feb 18, 2021
I have a similar problem:
Does anyone have a suggestion on how to solve?
My tf version is 2.3
My numpy version is 1.19
my python version is 3.7
Thanks!
IKsares commentedon Feb 23, 2021
I'm having the same issue. This happened after installing scipy. How do I edit my PATH variable?
iamMeshi commentedon Feb 23, 2021
The only thing that solved this issue for me was to upgrade the libaries in this order. Uninstalling them and reinstalling them didn't work, I had to use
--upgrade. Here's the link:https://stackoverflow.com/a/50792985/9134698