machine-learning-engineering-for-production-public icon indicating copy to clipboard operation
machine-learning-engineering-for-production-public copied to clipboard

Missing correct ipython kernel in c1w1, conda method

Open B0B44 opened this issue 3 years ago • 0 comments

While following instructions after launching the Jupiter lab, I noticed that kernel was missing. The default kernel named "Python" could not be launched due to an exception regarding distutils.

Traceback from Jupyter lab server log:

[I 2022-06-12 11:22:32.002 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (5/5), new random ports
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/bob/.local/lib/python3.6/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "/home/bob/.local/lib/python3.6/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/home/bob/.local/lib/python3.6/site-packages/ipykernel/connect.py", line 16, in <module>
    import jupyter_client
  File "/home/bob/.local/lib/python3.6/site-packages/jupyter_client/__init__.py", line 6, in <module>
    from .asynchronous import AsyncKernelClient  # noqa
  File "/home/bob/.local/lib/python3.6/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
  File "/home/bob/.local/lib/python3.6/site-packages/jupyter_client/asynchronous/client.py", line 8, in <module>
    from jupyter_client.client import KernelClient
  File "/home/bob/.local/lib/python3.6/site-packages/jupyter_client/client.py", line 20, in <module>
    from .connect import ConnectionFileMixin
  File "/home/bob/.local/lib/python3.6/site-packages/jupyter_client/connect.py", line 27, in <module>
    from jupyter_core.paths import jupyter_data_dir  # type: ignore
  File "/usr/lib/python3/dist-packages/jupyter_core/paths.py", line 21, in <module>
    from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'

This issue can be avoided by registering the conda environment python runtime with ipython, using the following command

python -m ipykernel install --user --name mlep-w1-lab

I'll create a pull request with an updated readme file if given the green light.

B0B44 avatar Jun 12 '22 08:06 B0B44