ModuleNotFoundError: There is not a labextensions at . when exec "jupyter labextension develop . --overwrite" in terminal

Viewed 241
  1. Summary of the problem.

I am developing an extension of jupyterlab. The extension has both frontend part and server(python) part. However, after I install the extension according to tutorial and readMe.md. The jupyterlab cannot load the server. I try to run the commands again, run into the problem of: ModuleNotFoundError: There is not a labextensions at . when executing "jupyter labextension develop . --overwrite" in terminal.

The tutorial: https://jupyterlab.readthedocs.io/en/stable/extension/extension_tutorial.html#extension-tutorial The README.md likes:

# Clone the repo to your local environment
# Change directory to the athena_jupyter directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable athena_jupyter
# Rebuild extension Typescript source after making changes
jlpm run build
  1. What I have tried.

2.1 follow the readme.txt several times.

2.2 create a new conda environment, the initial project worked. However, when I add something, rebuild, it failed again.

2.3 remove something about the jupyterlab extension config. because it has other warning log: my extension is not found.

2.4 in fact, i meet this problem server times. I tried lot of things and it is solved, but i don't know what's the problem and cannot get a summary solution to this problem, and this time i cannot solve it.

Thanks in advance!

1 Answers

This error can be reproduced by removing the _jupyter_labextension_paths from the extension's __init__.py.

E.g.,something like this should be in the __init__.py file.

def _jupyter_labextension_paths():
    return [{
        "src": "labextension",
        "dest": data["name"]
    }]

Perhaps newer versions of the cookiecutter produce a project that does not depend on the presence of _jupyter_labextension_paths in __init__.py: https://github.com/jupyterlab/jupyterlab-module-federation/issues/61

Related