Extension shows up as both installed and uninstalled and doesn't work

Somehow I seem to have gotten my installed extensions into a not entirely working and/or internally inconsistent state, in particular the jupyterlab-vim extension is showing up as installed/enabled and OK… but also under “Uninstalled core extensions.” when I do jupyter labextension list:

JupyterLab v1.2.3
Known labextensions:
   app dir: /home/zane/miniconda3/envs/pudl-dev/share/jupyter/lab
        @jupyterlab/toc v1.0.1  enabled  OK
        jupyterlab_vim v0.11.0  enabled  OK
        nbdime-jupyterlab v1.0.0  enabled  OK

Uninstalled core extensions:
    jupyterlab_vim

It also shows up in the extension manager sidebar, as installed & enabled. However, Jupyterlab behaves as if the extension is not installed at all – the functionality that it is supposed to provide is not available.

However, if I uninstall it, things break – the extension manager sidebar turns into a Server Error 500 message, and when I do jupyter labextension list I get:

JupyterLab v1.2.3
Known labextensions:
   app dir: /home/zane/miniconda3/envs/pudl-dev/share/jupyter/lab
        @jupyterlab/toc v1.0.1  enabled  OK
        nbdime-jupyterlab v1.0.0  enabled  OK

Uninstalled core extensions:
    jupyterlab_vim
An error occured.
KeyError: 'jupyterlab_vim'
See the log file for details:  /tmp/jupyterlab-debug-pfpcdzp9.log

The logfile contains:

Yarn configuration loaded.
   app dir: /home/zane/miniconda3/envs/pudl-dev/share/jupyter/lab
        @jupyterlab/toc v1.0.1  enabled  OK
        nbdime-jupyterlab v1.0.0  enabled  OK
Traceback (most recent call last):

  File "/home/zane/miniconda3/envs/pudl-dev/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/home/zane/miniconda3/envs/pudl-dev/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 93, in start
    ans = self.run_task()

  File "/home/zane/miniconda3/envs/pudl-dev/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 239, in run_task
    app_dir=self.app_dir, logger=self.log, core_config=self.core_config))

  File "/home/zane/miniconda3/envs/pudl-dev/lib/python3.7/site-packages/jupyterlab/commands.py", line 515, in list_extensions
    return handler.list_extensions()

  File "/home/zane/miniconda3/envs/pudl-dev/lib/python3.7/site-packages/jupyterlab/commands.py", line 728, in list_extensions
    messages = self.build_check(fast=True)

  File "/home/zane/miniconda3/envs/pudl-dev/lib/python3.7/site-packages/jupyterlab/commands.py", line 760, in build_check
    new_package = self._get_package_template(silent=fast)

  File "/home/zane/miniconda3/envs/pudl-dev/lib/python3.7/site-packages/jupyterlab/commands.py", line 1241, in _get_package_template
    data['jupyterlab']['mimeExtensions'].pop(item)

KeyError: 'jupyterlab_vim'

Exiting application: jupyter

I created a new jlab-test environment and installed just jupyterlab and the Vim extension, and in that context, it works fine. So I don’t think the problem is with the extension, but rather with this inconsistent installation state – is there some way to clean up the installed extension environment and get it back to a pristine state?

3 Likes

Hi, I also have the same problem as you met.

As the result I investigated the structure of my dir and files, it seems that there is a log file(~.venv\share\jupyter\lab\settings\build_config.json, this is the case of my environment) in which uninstalled extension lists are registered.

After deleting a package-name: jupyterlab_vim is maybe registered in your case, ‘’$ jupyter labextension list’’ works. But I don’t check whether ‘‘jupyter lab build’’ works. I’ll try it in the near future.

{
    "uninstalled_core_extensions": [
        "jupyterlab-chart-editor" <- package-name registered in my case(I deleted, and works)
    ]
}
1 Like

I encountered a similar problem here. I wanted to update the matplotlib widget but first uninstalled the extension. This got listed in the aforementioned json file. After reinstalling the matplotlib widget the state of jupyter lab look as follows:

JupyterLab v1.2.6
Known labextensions:
   app dir: C:\Miniconda3\envs\jupyter\share\jupyter\lab
        @jupyter-widgets/jupyterlab-manager v1.1.0 enabled  ok
        @jupyterlab/toc v1.0.1 enabled  ok
        @ryantam626/jupyterlab_code_formatter v1.1.0 enabled  ok
        jupyter-matplotlib v0.5.0 enabled  ok
        jupyterlab-flake8 v0.4.1 enabled  ok
        jupyterlab-jupytext v1.1.0 enabled  ok

Uninstalled core extensions:
    jupyter-matplotlib

The matplotlib widget failed to load, rebuilding or reinstallation did not change the situation. Manually deleting the .json file lead to jupyter recognizing that a rebuild is required.

JupyterLab v1.2.6
Known labextensions:
   app dir: C:\Miniconda3\envs\jupyter\share\jupyter\lab
        @jupyter-widgets/jupyterlab-manager v1.1.0 enabled  ok
        @jupyterlab/toc v1.0.1 enabled  ok
        @ryantam626/jupyterlab_code_formatter v1.1.0 enabled  ok
        jupyter-matplotlib v0.5.0 enabled  ok
        jupyterlab-flake8 v0.4.1 enabled  ok
        jupyterlab-jupytext v1.1.0 enabled  ok

Build recommended, please run `jupyter lab build`:
    jupyter-matplotlib needs to be included in build

After the rebuild everything worked again. So I think this is definitely a bug.

2 Likes

I got a user report this on three extensions: https://github.com/krassowski/jupyterlab-lsp/issues/203#issuecomment-599300121. Did anyone open an issue on GitHub already?

Here is the GitHub issue: https://github.com/jupyterlab/jupyterlab/issues/8122. Removing build_config.json worked for me.