Can't install any jupyterlab extensions in docker image

Question:

I am running docker build task in Azure pipelines on a pipeline agent that runs on an on-prem host. I am trying to "RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager".

In the base image:
node=14.14.0
jupyter=1.0.0
jupyter-packaging = 0.7.12
jupyter-resource-usage= 0.5.1
jupyter_client = 6.1.7
jupyter_console = 6.2.0
jupyter_core = 4.7.0
jupyter_server = 1.6.1
jupyter_telemetry = 0.1.0
jupyterhub = 1.3.0
jupyterhub-base = 1.3.0
jupyterlab = 3.0.12
jupyterlab-git = 0.30.0b2
jupyterlab-templates = 0.2.5
jupyterlab_code_formatter=1.4.5
jupyterlab_pygments = 0.1.2
jupyterlab_server = 2.3.0

Dockerfile looks like this:

USER root
COPY files/.npmrc $HOME/.npmrc
RUN jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager .....

.npmrc looks like so:

always-auth=true
strict-ssl=false
registry=https://pkgs.dev.azure.com/org-name/proj-name/_packaging/proj-name/npm/registry/
https-proxy=the-proxy-url
proxy=the-proxy-url

The pipeline does the following tasks:

  1. Runs npmAuthenticate task on .npmrc to edit the .npmrc file with the auth-token. This succeeds..
  2. Next runs docker build. The Dockerfile instructs to copy this modified .npmrc to $HOME and tries to install lab extensions

Found this thread : https://github.com/jupyter-widgets/ipywidgets/issues/1982#issuecomment-468716770
We use jupyterlab v3. So node>=12 is required. So I changed the Dockerfile to:

USER root
COPY files/.npmrc $HOME/.npmrc
RUN conda remove nodejs && conda install -c conda-forge nodejs=12 && conda list | grep nodejs &&
jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager .....

Tried this also: https://stackoverflow.com/a/52484330/3575135 . Didnt help

The normal "npm install @angular/cli" works. But the lab extensions are giving me a hard time. Nothing seems to be working at this point..

This is the error:

ValueError: "@jupyter-widgets/jupyterlab-manager" is not a valid npm package

Please help!

Asked By: Seeker

||

Answers:

You should NOT be installing Node.js nor @jupyter-widgets/jupyterlab-manager for JupyterLab 3.0+. The extension system has been improved and the new "federated extensions" system no longer requires Node.js (and majority of extensions have migrated away from Node.js requirement). The readme of @jupyter-widgets/jupyterlab-manager clearly states that for JupyterLab 3.0+ you should use:

pip install jupyterlab_widgets

The same goes for most extensions – they will have a name of the PyPI package in their readme if they migrated. For more in-depth explanation please read this answer.

As a good advice please only use jupyter labextension install for extensions that have not migrated to pip/conda-installable federated extensions.

Answered By: krassowski

Copied the npmrc to /.npmrc instead of $HOME/.npmrc. This worked

Answered By: Seeker

@krassowski this not correct at all. Running

jupyter labextension install

yields this:

(Deprecated) Installing extensions with the jupyter labextension install command is now deprecated and will be removed in a future major version of JupyterLab.

Users should manage prebuilt extensions with package managers like pip and conda, and extension authors are encouraged to distribute their extensions as prebuilt packages

Answered By: demoman