microsoft / CNTK

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit
https://docs.microsoft.com/cognitive-toolkit/
Other
17.53k stars 4.28k forks source link

`import cntk` after installing v2.3.1 wheels fails with `DLL load failed: The specified module could not be found.` #3504

Open syagev opened 6 years ago

syagev commented 6 years ago

The wheels for CNTK v2.3.1 for Python 3.6 (both CPU-only and GPU) from https://docs.microsoft.com/en-us/cognitive-toolkit/setup-windows-python?tabs=cntkpy231#1-install-from-pypi do not seem to work properly.

To reproduce, on a clean python environment on windows run:

pip install https://cntk.ai/PythonWheel/CPU-only/cntk-2.3.1-cp36-cp36m-win_amd64.whl
python -c "import cntk"

The second command will fail with:

Traceback (most recent call last):
  File "***\AppData\Roaming\Python\Python36\site-packages\cntk\cntk_py.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'cntk._cntk_py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "***\AppData\Roaming\Python\Python36\site-packages\cntk\__init__.py", line 10, in <module>
    from . import cntk_py
  File "***\AppData\Roaming\Python\Python36\site-packages\cntk\cntk_py.py", line 21, in <module>
    _cntk_py = swig_import_helper()
  File "***\AppData\Roaming\Python\Python36\site-packages\cntk\cntk_py.py", line 20, in swig_import_helper
    return importlib.import_module('_cntk_py')
  File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.
delzac commented 6 years ago

the wheels from pre-cntk 2.5 has this issue. It can be resolved by appending the path of _cntk_py into sys PATH before you write any script.

Any reason you are using cntk2.3 instead of the current 2.6?

syagev commented 6 years ago

Yeah I figured. I was just testing some code which used to work with 2.3.1 but didn't work with 2.6 and wanted to test whether cntk was the underlying issue (it wasn't...). Thanks