Closed timeregained closed 5 years ago
You must activate your conda environment in any other cmd.exe
shell. Powershell
support is planned but not yet ready.
https://conda.io/docs/user-guide/tasks/manage-environments.html
Closed as not a bug.
@mingwandroid ,
I have pointed in my previous comment :"I also tired to remove numpy from anaconda and install numpy with pip instead, it shows the pip version numpy(numpy-1.15.2-cp37-none-win_amd64.whl) does not have this issue."
It seems this issue related to the numpy package from anaconda rather than procedure of activating conda environment in shell.
Out software requires activation. In this instance it sets PATH so the DLLs get found.
So you need to activate.
@mingwandroid
Thanks a lot for your reply.
And If it is a requirement for using anaconda python, would you please kindly help to advise how to make xlwings working as previous?
In previous anaconda release, this package only need to know the path of python and all works well.
e.g. anaconda python 3.6 (python 3.6.6 hea74fb7_0;numpy 1.15.2 py36ha559c80_0) does work well without any activation. However, I have tried Anaconda python 3.7 with numpy both 1.14 and 1.15, neither of them could work without activation.
So is this activation only get to be necessary when using Anaconda with python 3.7? I have checked the package structure of numpy-1.15.2-py36ha559c80_0 , it seems all the same as numpy-1.15.2 py37ha559c80_0, if some dlls needed to be found with the activation of shell instance, I think both of them should fail rather than only failed in 3.7 build.
I removed a hack deep in the guts of our python recently whereby it modified the PATH environment variable if it detected activation may not have happened correctly.
This breaks countless things in 3rd party software. I had no choice.
The simplest example of this breakage is trying to use Python to query PATH. It will give the incorrect answer.
But regardless, activation can involve more than setting PATH, packages can do arbitrary things in activation scripts. In summary, if you choose to not activate then you can expect things to fail and we're not going to spend time debugging that for you.
And packages that previously didn't require activation scripts can later introduce something that does require them so just because something (skipping activation) worked with an old package it doesn't mean it will continue to.
This isn't what's going on here though!
Thanks again for your patient, I will report this issue to xlwings maintenance guys, wish they would follow up the change.
This is an end user issue nothing to do with any package. You are meant to activate your envs somehow (Anaconda Prompt, Anaconda navigator or by manually calling activate).
Entry point for xlwings is from within Excel (for udfs) so it's not really an end user thing.
You can try setting the env var to use the alternate DLL loading scheme. More info at https://conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#numpy-mkl-library-load-failed
Actual Behavior
numpy cannot be imported exclude in anaconda prompt, in other shell like cmd or powershell, it throw an import error as:
C:\Users\someone\AppData\Local\Continuum\miniconda3\python.exe -c "import numpy; numpy.test()" Traceback (most recent call last): File "C:\Users\jti\AppData\Local\Continuum\miniconda3\lib\site-packages\numpy\core__init__.py", line 16, in
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 "", line 1, in
File "C:\Users\jti\AppData\Local\Continuum\miniconda3\lib\site-packages\numpy__init.py", line 142, in
from . import add_newdocs
File "C:\Users\jti\AppData\Local\Continuum\miniconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "C:\Users\jti\AppData\Local\Continuum\miniconda3\lib\site-packages\numpy\lib__init__.py", line 8, in
from .type_check import *
File "C:\Users\jti\AppData\Local\Continuum\miniconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in
import numpy.core.numeric as _nx
File "C:\Users\jti\AppData\Local\Continuum\miniconda3\lib\site-packages\numpy\core\ init__.py", line 26, in
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try
git clean -xdf
(removes all files not under version control). Otherwise reinstall numpy.Original error was: DLL load failed: The specified module could not be found.
Note: Anaconda recommend not to add the path to the system environment variable , so I need to use absolute python path.
This issue affects xlwings projects, any scripts import numpy would through the same import error when calling in excel.
Expected Behavior
numpy could be imported as normal as before.
Steps to Reproduce
I have tested in 3 different pc, one PC is installed windows 10 1809, other 2 is windows 10 1709, all of them repeated the issue as the same.
I have tried to downgrade numpy to 1.15.1 but it perform the same, however, another pc with python 3.6.6 is not affected by this issue.(python 3.6.6 hea74fb7_0;numpy 1.15.2 py36ha559c80_0)
I also tired to remove numpy from anaconda and install numpy with pip instead, it shows the pip version numpy(numpy-1.15.2-cp37-none-win_amd64.whl) does not have this issue.
Anaconda or Miniconda version:
anaconda custom py37_0
Operating System:
Windows 10 x64 1709.
conda info
conda list --show-channel-urls