0

The code I run are as follows: (link:https://colab.research.google.com/drive/1RBbhOx4XHOe8lCwHgwhGs12WcVBz_Vzu#scrollTo=pGCXryUwL949&uniqifier=6)

!sudo update-alternatives --config python3
!sudo apt install python3-pip
!curl https://bootstrap.pypa.io/pip/3.6/get-pip.py -o get-pip.py
!pip!python3 get-pip.py --force-reinstall
!sudo apt-get install --no-install-recommends openmpi-bin libopenmpi-dev libopencv-dev python3-      opencv python-opencv && ln -sf /usr/lib/x86_64-linux-gnu/libmpi_cxx.so /usr/lib/x86_64-linux-gnu/libmpi_cxx.so.1 && ln -sf /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so.12 && ln -sf /usr/lib/x86_64-linux-gnu/libmpi.so /usr/lib/x86_64-linux-gnu/libmpi.so.12 && pip install cntk-gpu
import sys
sys.path.append('/usr/local/lib/python3.6/dist-packages')
sys.path.append('/usr/local/lib/python3.6')
sys.path.append('/usr/local/lib/python3.6/dist-packages/IPython/extensions')
sys.path.append('/usr/local/lib/python3.6/cntk')
import cntk

The error I run into:

/usr/local/lib/python3.6/dist-packages/cntk/cntk_py_init.py:56: UserWarning: Unsupported Linux distribution (ubuntu-18.04). CNTK supports Ubuntu 16.04 and above, only.
  warnings.warn('Unsupported Linux distribution (%s-%s). CNTK supports Ubuntu 16.04 and above, only.' % (__my_distro__, __my_distro_ver__))
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/cntk/cntk_py.py in swig_import_helper()
     17         try:
---> 18             return importlib.import_module(mname)
     19         except ImportError:

8 frames
/usr/lib/python3.8/importlib/__init__.py in import_module(name, package)
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 

/usr/lib/python3.8/importlib/_bootstrap.py in _gcd_import(name, package, level)

/usr/lib/python3.8/importlib/_bootstrap.py in _find_and_load(name, import_)

/usr/lib/python3.8/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'cntk._cntk_py'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-62-77b2b553a1fc> in <module>
----> 1 import cntk

/usr/local/lib/python3.6/dist-packages/cntk/__init__.py in <module>
     21 from . import cntk_py_init
     22 cntk_py_init.cntk_check_distro_info()
---> 23 cntk_py_init.cntk_check_libs()
     24 
     25 import numpy as np

/usr/local/lib/python3.6/dist-packages/cntk/cntk_py.py in <module>
     19         except ImportError:
     20             return importlib.import_module('_cntk_py')
---> 21     _cntk_py = swig_import_helper()
     22     del swig_import_helper
     23 elif _swig_python_version_info >= (2, 6, 0):

/usr/local/lib/python3.6/dist-packages/cntk/cntk_py.py in swig_import_helper()
     18             return importlib.import_module(mname)
     19         except ImportError:
---> 20             return importlib.import_module('_cntk_py')
     21     _cntk_py = swig_import_helper()
     22     del swig_import_helper

/usr/lib/python3.8/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

ModuleNotFoundError: No module named '_cntk_py'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Comments and question Through my search I find that this seems to be due to be due to that the Ubuntu that colab runs on is 18.04, and I haven't find a work around for that yet. Is there a work around? There are also mentioning about pathing problems during package search, but I have already added the path through sys.path.append. So is there any thing that I missed here? Also, would there be anyother reason for importing of cntk not work on google colab?

Here is a list of reference I found and tried but none of the solution seem to work: Why is import cntk as C not working in google colab https://github.com/microsoft/CNTK/issues/3285 https://github.com/microsoft/CNTK/issues/1553 Why is import cntk as C not working in google colab CNTK (Microsoft Cognitive Toolkit) ImportError

0 Answers0