CNTK ImportError: DLL load failed: The specified module could not be found.
Dealing with occurrence
Introduction
When introducing CNTK, in the command on ipython or anaconda, there is no error in import.
Visual Studio Code
Visual Studio 2015
Eclipse + PyDev
When using the IDE, an error appeared and it was hard to deal with it. I will describe the action actually done.
※ It is 2017/8/15 point. I hope for a future solution.
※ Is there a post in the official comment?
※ Although there was a similarity to Github issue # 969, since coping was not clear, I wrote it. Https://github.com/Microsoft/CNTK/issues/969
Occurred when you did the above.
https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-Windows-Python?tabs=cntkpy21
import sys
print(sys.path)
print (sys.version)
import cntk as C
print("CNTK imported")
['c:\\umezaki\\github\\cntk\\cntkTest', 'C:\\Anaconda3\\python36.zip', 'C:\\Anaconda3\\DLLs', 'C:\\Anaconda3\\lib', 'C:\\Anaconda3', 'C:\\Anaconda3\\lib\\site-packages', 'C:\\Anaconda3\\lib\\site-packages\\Sphinx-1.5.6-py3.6.egg', 'C:\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg']
3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]
File "c:\umezaki\github\cntk\cntkTest\cntkTest.py", line 24, in <module>
import cntk as C
File "C:\Anaconda3\lib\site-packages\cntk\__init__.py", line 10, in <module>
from . import cntk_py
File "C:\Anaconda3\lib\site-packages\cntk\cntk_py.py", line 21, in <module>
_cntk_py = swig_import_helper()
File "C:\Anaconda3\lib\site-packages\cntk\cntk_py.py", line 20, in swig_import_helper
return importlib.import_module('_cntk_py')
File "C:\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: 指定されたモジュールが見つかりません。
Solution
Pass the path of Anaconda 3 to the environment variable PATH. (In the virtual environment, the root path of the virtual environment)
It is better to restart the IDE.
['c:\\umezaki\\github\\cntk\\cntkTest', 'C:\\Anaconda3\\python36.zip', 'C:\\Anaconda3\\DLLs', 'C:\\Anaconda3\\lib', 'C:\\Anaconda3', 'C:\\Anaconda3\\lib\\site-packages', 'C:\\Anaconda3\\lib\\site-packages\\Sphinx-1.5.6-py3.6.egg', 'C:\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg']
3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]
CNTK imported
Appendix
下記に従い、英語にしてみました。
I tried to English in accordance with the following.