Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyDev/Eclipse not loading _mklinit when run from a Conda environment

I created a conda environment - testenv2 - installed python/numpy/pandas. Added it as the interpreter in Eclipse project settings and using it to run my test python script. And I am getting the below error. The same test script works fine from command line when I activate the conda environment and run from with in it. It also works from PyCharm. But somehow fails to launch in Eclipse.

Traceback (most recent call last):
  File "C:\Data\projects\eclipse-workspace\PythonEclipse\Test.py", line 1, in <module>
    import numpy as np
  File "C:\Data\devtools\Anaconda3\envs\testenv2\lib\site-packages\numpy\__init__.py", line 140, in <module>
    from . import _distributor_init
  File "C:\Data\devtools\Anaconda3\envs\testenv2\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.

If I just run the same test script using my root Conda Python interpreter, it works fine. So it is only when I try to use the environment I created from conda.

Thanks for the help!

like image 351
endless Avatar asked Dec 10 '22 03:12

endless


2 Answers

Add CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 to your environment variables.

For VSCode, either an .env file in your workspace folder or "env" key in launch.json should do the trick.

Source: https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#numpy-mkl-library-load-failed

like image 129
Fedor Golishevskiy Avatar answered Dec 12 '22 15:12

Fedor Golishevskiy


I have to put following into my path environment variable: E:\program\Anaconda3\Library\bin , otherwise I got the same problem.

like image 32
jerron Avatar answered Dec 12 '22 15:12

jerron