I have new Anaconda and PyCharm installations on Windows machine.
Simply running
import numpy
raises
ImportError: DLL load failed: The specified module could not be found.
In similar questions (1, 2), people suggest to check that PATH
has paths to DLLs.
In my case - it does! But instead, I have additional paths prepended to PATH
when I start something from PyCharm. And I think this could be the problem.
When running from Anaconda prompt, sys.path
is:
C:\Users\usr\Anaconda3\python37.zip
C:\Users\usr\Anaconda3\DLLs
C:\Users\usr\Anaconda3\lib
C:\Users\usr\Anaconda3
C:\Users\usr\Anaconda3\lib\site-packages
C:\Users\usr\Anaconda3\lib\site-packages\win32
C:\Users\usr\Anaconda3\lib\site-packages\win32\lib
C:\Users\usr\Anaconda3\lib\site-packages\Pythonwin
When running from python console in Pycharm, sys.path
is the same, except that now we have two addional lines in the beginning of the file:
C:\Users\usr\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\182.4505.26\helpers\pydev
C:\Users\usr\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\182.4505.26\helpers\pydev
By the way, the initial error is raised from C:\Users\usr\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\182.4505.26\helpers\pydev\_pydev_bundle\pydev_import_hook.py
.
So I think this locates the problem, yet I don't know why it arises, why it didn't happen on my other machine, and more importantly, how to fix it?
Technical data:
PyCharm 2018.2.4 (Community Edition)
Build #PC-182.4505.26, built on September 19, 2018
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Python: 3.7, 3.6.6;
numpy: 1.15.4; 1.14.6