Prebuilt Extension "Error: No provider for: @jupyterlab/coreutils:ISettingRegistry."

I am currently moving a frontend JupyterLab 3 extension (@juxl/juxl-extension, version 3.1.2) from installation via npm to installation via pip.

I am able to create corresponding local pip packages, but when installing the extension via local whl file in a local conda environment and starting JupyterLab, I get the error message:
Error: No provider for: @jupyterlab/coreutils:ISettingRegistry.

When installing the extension not via the local whl file, but via jlpm, jlpm build:lib:prod (tsc) and jupyter labextension install . it runs as expected.

Does anyone know, why the error Error: No provider for: @jupyterlab/coreutils:ISettingRegistry. is given only when installing the extension via pip?

Furthermore I tried to install it in a local docker environment, but again i get the same error, but with different details:


Dockerfile:

ARG BASE_IMAGE=registry.git.rwth-aachen.de/jupyter/profiles/rwth-courses:latest
FROM ${BASE_IMAGE}

# add additional pip installs to base env:
ADD requirements.txt .
RUN pip install -r requirements.txt

# add juxl extension extension
ADD juxl_extension-3.2.0-py3-none-any.whl .
RUN pip install juxl_extension-3.2.0-py3-none-any.whl

RUN jupyter labextension install @juxl/logging@^3.1.1

# Copy overrides into corresponding directory
COPY --chown=1000 juxl.jupyterlab-settings /opt/conda/share/jupyter/lab/settings/overrides.json

A couple of possible causes include the activation of the extension before the core plugin providing ISettingRegistry is registered (e.g. if your extension provides another token replacing a core token), misconfiguration of dependencies (using a token from old version), or misconfiguration of webpack hints in jupyterlab stanza of package.json (e.g. singleton). It would be much easier to advise if you could share the code of the extension. If you cannot share it publicly feel free to send me a direct message.

The problem was related to using:

import { ISettingRegistry } from "@jupyterlab/settingregistry/lib/tokens"

instead of:

import { ISettingRegistry } from "@jupyterlab/settingregistry"

The difference is that when webpack builds the extension for use with federated modules it only knows about packages like @jupyterlab/settingregistry and cannot guarantee that paths that it does not know will be be available in which case it might vendor a copy of the module to ensure that the code will be available. Because tokens are matched by instance identity, if a different copy of a token is requested than the one registered an error like above will be seen. This is why it is important that packages providing tokens for consumption in other packages are marked as singletons an imported using the public API.

1 Like