0

I use Pydev and try to load numpy in my script. I installed Anaconda to be able to use it, following the Anaconda user guide concerning how to set it up as interpreter in Pydev.

I have tried installing Anaconda both with and without adding it to PATH (the recommended version is without). In both cases numpy shows up as an installed package in Pydev: enter image description here

However, when I run my script I receive the following error:

File "Z:\Path\To\My\file.py", line 2, in <module>
    import numpy as np
  File "C:\Users\(username)\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
    from . import _distributor_init
  File "C:\Users\(username)\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
    from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.

I also noticed that in the manual from anaconda, in the shown picture a lot more library folders are added than what I am presented with. I couldn't find a list of those, though. Running numpy from the Anaconda prompt works fine.

Any ideas would be appreciated!

Paul Paulsen
  • 355
  • 4
  • 18
  • Seems like a case of https://github.com/ContinuumIO/anaconda-issues/issues/10884 – Dolfa Dec 03 '19 at 09:41
  • @Dolfa Thanks for the link. There are a couple of proposed solutions. Adding Anaconda to `PATH` at installation didn't help. Setting `CONDA_DLL_SEARCH_MODIFICATION_ENABLE to 1` didn't help either. Could it be that I have to tell pydev to activate the Anaconda environment somehow? Running numpy within the anaconda prompt works fine. – Paul Paulsen Dec 03 '19 at 10:00
  • Here is similar question on SO: https://stackoverflow.com/questions/54974444/pydev-eclipse-not-loading-mklinit-when-run-from-a-conda-environment – Dolfa Dec 03 '19 at 10:18
  • You were right, it seems that PyDev has issues with activating conda environment, here are steps that should work: https://github.com/ContinuumIO/anaconda-issues/issues/10869 , please try them and if they would work, add them as answer to your question – Dolfa Dec 03 '19 at 10:25
  • @Dolfa: Adding the extra paths as an environment variable in Pydev as described in the issue fixes the problem. Feel free to post an answer, otherwise I will do so later today. – Paul Paulsen Dec 03 '19 at 11:19
  • @Paul Paulsen In your screenshot there's a `Load conda env vars before run`... if you enable that checkbox, do things work? – Fabio Zadrozny Dec 03 '19 at 18:47
  • @FabioZadrozny If I remember correctly I tried that without any avail. However, I can't verify this now because somehow the environment variable always reappears, even if I remove it, so I can't check how it works without it. – Paul Paulsen Dec 11 '19 at 15:20

0 Answers0