CNTK 2.2 fails to import in Python when installed from pip (does not occur with CNTK 2.1)

Created on 23 Sep 2017  路  2Comments  路  Source: microsoft/CNTK

Steps

Build a Docker container with this Dockerfile:

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y python3-dev python3-pip openmpi-bin
RUN pip3 install --upgrade pip
RUN pip3 install https://cntk.ai/PythonWheel/CPU-Only/cntk-2.2-cp35-cp35m-linux_x86_64.whl

Then in the container, run python3 -c "import cntk; print(cntk.__version__)".

Actual Results:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/cntk/cntk_py.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: 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 "/usr/local/lib/python3.5/dist-packages/cntk/__init__.py", line 10, in <module>
    from . import cntk_py
  File "/usr/local/lib/python3.5/dist-packages/cntk/cntk_py.py", line 21, in <module>
    _cntk_py = swig_import_helper()
  File "/usr/local/lib/python3.5/dist-packages/cntk/cntk_py.py", line 20, in swig_import_helper
    return importlib.import_module('_cntk_py')
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libjpeg.so.8: cannot open shared object file: No such file or directory

Expected Results

The version 2.2 is output to console.

This issue does not reproduce when repeating the steps and replacing the 2.2 with 2.1 in the Dockerfile.

Most helpful comment

Huh, that did the trick. Works now after adding a libopencv-dev and python-opencv package to the example.

When I saw that note in the release notes I thought it would only impact the Tensorboard feature, and since OpenCV is a heavy dependency I would prefer to avoid it.

At the least, the OpenCV dependency should be mentioned in the Microsoft Python-only install documentation.

Closing.

All 2 comments

You need to install OpenCV first. This is a breaking requirement as described in the release notes.

Huh, that did the trick. Works now after adding a libopencv-dev and python-opencv package to the example.

When I saw that note in the release notes I thought it would only impact the Tensorboard feature, and since OpenCV is a heavy dependency I would prefer to avoid it.

At the least, the OpenCV dependency should be mentioned in the Microsoft Python-only install documentation.

Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jsundh picture jsundh  路  16Comments

Madgeeno picture Madgeeno  路  31Comments

Arminea picture Arminea  路  19Comments

kasungayan picture kasungayan  路  20Comments

StevenGann picture StevenGann  路  125Comments