StatCan / aaw-kubeflow-containers

Containers built to be used with Kubeflow for Data Science
Other
24 stars 21 forks source link

Builds blocked by JupyterLab Python package error. #623

Open bryanpaget opened 3 months ago

bryanpaget commented 3 months ago

On May 06 2024 'master/main' and 'master-2.0/main-2.0' stopped building due to

Error Message:

jupyterlab | error adding extension (enabled: True): The module 'jupyterlab' could not be found (cannot import name 'get_allowed_levels' from 'jupyterlab_server.config' (/opt/conda/lib/python3.11/site-packages/jupyterlab_server/config.py)). Are you sure the extension is installed?
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 322, in add_extension
        extpkg = ExtensionPackage(name=extension_name, enabled=enabled)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 186, in __init__
        self._load_metadata()
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 201, in _load_metadata
        raise ExtensionModuleNotFound(msg) from None
    jupyter_server.extension.utils.ExtensionModuleNotFound: The module 'jupyterlab' could not be found (cannot import name 'get_allowed_levels' from 'jupyterlab_server.config' (/opt/conda/lib/python3.11/site-packages/jupyterlab_server/config.py)). Are you sure the extension is installed?
A `_jupyter_server_extension_points` function was not found in nbclassic. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
Enabling: jupyter_server_proxy
- Writing config: /opt/conda/etc/jupyter
    - Validating jupyter_server_proxy...
      jupyter_server_proxy  OK
    - Extension successfully enabled.
Enabling notebook extension codefolding/main...
      - Validating: OK
Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-labextension", line 6, in <module>
    from jupyterlab.labextensions import main
  File "/opt/conda/lib/python3.11/site-packages/jupyterlab/labextensions.py", line 16, in <module>
    from .commands import (
  File "/opt/conda/lib/python3.11/site-packages/jupyterlab/commands.py", line 32, in <module>
    from jupyterlab_server.config import (
ImportError: cannot import name 'get_allowed_levels' from 'jupyterlab_server.config' (/opt/conda/lib/python3.11/site-packages/jupyterlab_server/config.py)
Removing intermediate container 14b113df31e5
The command '/bin/bash -o pipefail -c pip install     'git+https://github.com/betatim/vscode-binder' &&     mamba install --quiet --yes -c conda-forge     'jupyter_contrib_nbextensions'     'dash'     'plotly'     'ipywidgets'     'markupsafe'     'ipympl'     'pexpect==4.9.0'     'jupyter-server-proxy==4.1.2'     'jupyterlab-language-pack-fr-fr'     'jupyterlab_execute_time'     'nb_conda_kernels'     'jupyterlab-lsp'     'jupyter-lsp'  &&     jupyter server extension enable --py jupyter_server_proxy &&     jupyter nbextension enable codefolding/main --sys-prefix &&     jupyter labextension enable       '@jupyterlab/translation-extension'       '@jupyterlab/server-proxy'       'nbdime-jupyterlab'     &&     jupyter lab build &&     jupyter lab clean &&   clean-layer.sh &&   rm -rf /home/$NB_USER/.cache/yarn &&   rm -rf /home/$NB_USER/.node-gyp &&   fix-permissions $CONDA_DIR &&   fix-permissions /home/$NB_USER' returned a non-zero code: 1
make: *** [Makefile:206: build/jupyterlab-cpu] Error 1
Error: Process completed with exit code 2.
##[debug]Finishing: Build image

The most important part of the error is:

jupyterlab | error adding extension (enabled: True): The module 'jupyterlab' could not be found (cannot import name 'get_allowed_levels' from 'jupyterlab_server.config' (/opt/conda/lib/python3.11/site-packages/jupyterlab_server/config.py)). Are you sure the extension is installed?

Obviously jupyterlab is installed, (see https://github.com/jupyter/docker-stacks/blob/main/images/base-notebook/Dockerfile#L42). However, installing JupyterLab (see https://github.com/StatCan/aaw-kubeflow-containers/commit/9b5fcc27d2ea3adbfa3f5339d63f58337f3ed687) resolves the issue.

On May 06 2024, a new version of JupyterLab was released:

image

However, the refactored JupyerLab image builds just fine (https://github.com/StatCan/aaw-kubeflow-containers/blob/images-refactoring/dockerfiles/jupyterlab/Dockerfile) locally, so I'm assuming the issue has something to do with the way the aaw-kubeflow-containers has been designed.

TODO: understand why this happened in the first place.