# Pre-built extensions and labextension disable not working?

**URL:** https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318
**Category:** extensions
**Tags:** help-wanted
**Created:** [August 12, 2022, 12:31pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318 "2022-08-12T12:31:43Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![mcrutch](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mcrutch/32/2788_2.png) [@mcrutch](https://discourse.jupyter.org/u/mcrutch)
#### Post date: [August 12, 2022, 12:31pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/1 "2022-08-12T12:31:43Z")

</div>

Am I doing something wrong here? I have lab extensions that I distribute as pre-built extensions. Multiple UI extensions are all bundled in one Python package. Once they are all installed, if I want to disable only one, I should be able to do `jupyter labextension disable foo` but that doesn’t seem to be working with pre-built because they are included just by mere existence and still auto-run.

As an example: If I install jupyterlab-nbgallery, then disable @jupyterlab-nbgallery/gallerymenu and reload lab, that plugin is still executed.

Code: [lab-extensions/gallerymenu at main · nbgallery/lab-extensions · GitHub](https://github.com/nbgallery/lab-extensions/tree/main/gallerymenu)  
Environment:

```auto
$>jupyter labextension disable @jupyterlab-nbgallery/gallerymenu
$>jupyter labextension list
JupyterLab v3.4.3
/opt/conda/share/jupyter/labextensions
...
        @jupyterlab-nbgallery/environment-registration v1.0.0 enabled OK
        @jupyterlab-nbgallery/gallerymenu v1.0.0 disabled OK
        @jupyterlab-nbgallery/inject-uuid v1.0.0 enabled OK
...

Disabled extensions:
    @jupyterlab-nbgallery/gallerymenu (all plugins)

```

---

<div class="post-metadata">

### Author: ![cdanner](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/cdanner/32/7739_2.png) [@cdanner](https://discourse.jupyter.org/u/cdanner)
#### Post date: [August 18, 2022, 6:09pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/2 "2022-08-18T18:09:51Z")

</div>

I have recently been learning about managing extensions as well. I have a custom lab extension and wanted to enable/disable individual plugins like how I can with the [JupyterLab help extension](https://github.com/jupyterlab/jupyterlab/blob/744bda9f29f49b41d3842dff3ce8d32b7f2a58e8/packages/help-extension/src/index.tsx#L625-L629), which has four different plugins that can be individually controlled.

One thing I know is that you need to use the plugin ID, for example `@jupyterlab/help-extension:jupyter-forum` for the Jupyter Forum plugin.

I’m not familiar with this repo, but it looks like if you want to disable the [gallerymenu plugin](https://github.com/nbgallery/lab-extensions/blob/94cb32346e484f24d8d17e87d7c87ec83e604463/gallerymenu/src/index.ts#L38) from nbgallery, the plugin ID is `@jupyterlab-gallery/gallerymenu`, slightly different from the plugin name you used in your example.

---

<div class="post-metadata">

### Author: ![cdanner](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/cdanner/32/7739_2.png) [@cdanner](https://discourse.jupyter.org/u/cdanner)
#### Post date: [August 18, 2022, 6:12pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/3 "2022-08-18T18:12:50Z")

</div>

Using this approach, I was able to enable/disable individual plugins in my own custom JupyterLab extension with one problem. For example, if I disable a single plugin and then run `jupyter labextension list`, it doesn’t list the individual plugin as being disabled, but when I run jupyter lab, I can see based on the behavior that it is disabled. The JupyterLab help extension I mentioned previously doesn’t have this problem – the disabled plugins get listed properly. 😕

---

<div class="post-metadata">

### Author: ![krassowski](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/krassowski/32/1685_2.png) [@krassowski](https://discourse.jupyter.org/u/krassowski)
#### Post date: [August 18, 2022, 7:01pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/4 "2022-08-18T19:01:38Z")

</div>

What is in your `jupyter labextension list` (is it listed as enabled or not at all)? How does it look when it is enabled? What version of JupyterLab?

---

<div class="post-metadata">

### Author: ![cdanner](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/cdanner/32/7739_2.png) [@cdanner](https://discourse.jupyter.org/u/cdanner)
#### Post date: [August 18, 2022, 7:13pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/5 "2022-08-18T19:13:49Z")

</div>

Oh, wow, thanks for asking!

I’m using jupyterlab version 3.4.5 with retrolab version 0.3.21, and my custom extension jupyterlab-cdanner, all installed using pip. (I built my extension using `python -m build` and pip installed from the wheel file.)

`jupyter labextension list` gives me the following.

```auto
JupyterLab v3.4.5
/opt/home/build/.pyenv/versions/3.9.12/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        jupyterlab-cdanner v0.1.0 enabled OK (python, jupyterlab_cdanner)
        @retrolab/lab-extension v0.3.21 enabled OK

Disabled extensions:
    @retrolab/lab-extension:interface-switcher

```

I have a plugin with plugin ID `@cdanner/lab-extension:hide-menu-plugin` that hides the RetroLab main menu in my notebook, and I found that I can disable it using `jupyter labextension disable @cdanner/lab-extension:hide-menu-plugin`. However, if I run `jupyter labextension disable`, the output is identical to the previous, although the behavior reflects it being disabled.

---

<div class="post-metadata">

### Author: ![cdanner](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/cdanner/32/7739_2.png) [@cdanner](https://discourse.jupyter.org/u/cdanner)
#### Post date: [August 18, 2022, 7:14pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/6 "2022-08-18T19:14:40Z")

</div>

Oh, I did not mention this, but yes, I also disabled the RetroLab interface switcher plugin because I wanted it disabled, and it shows up on the disabled list as I would expect.

---

<div class="post-metadata">

### Author: ![krassowski](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/krassowski/32/1685_2.png) [@krassowski](https://discourse.jupyter.org/u/krassowski)
#### Post date: [August 19, 2022, 11:21am UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/7 "2022-08-19T11:21:02Z")

</div>

Looks like a bug. I was not able to reproduce with my extensions but maybe we do something different. I tried:

```auto
jupyter labextension disable @krassowski/jupyterlab-lsp:hover

```

and then the list correctly shows it as disabled:

```auto
JupyterLab v3.4.5
~/.local/share/jupyter/labextensions
        nbdime-jupyterlab v2.1.0 enabled OK

../envs/x/share/jupyter/labextensions
        jupyter-cytoscape v1.3.3 enabled OK
        jupyter-matplotlib v0.11.0 enabled OK
        spreadsheet-editor v0.6.1 enabled OK (python, jupyterlab-spreadsheet-editor)
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        jupyterlab-dagitty v0.3.5 enabled OK (python, jupyterlab-dagitty)
        jupyterlab-unfold v0.2.2 enabled OK (python, jupyterlab-unfold)
        @jupyter-server/resource-usage v0.6.1 enabled OK (python, jupyter-resource-usage)
        @ijmbarr/jupyterlab_spellchecker v0.7.2 enabled OK (python, jupyterlab-spellchecker)
        @jupyterlab/git v0.37.1 enabled OK (python, jupyterlab-git)
        @krassowski/jupyterlab-lsp v3.10.1 enabled OK (python, jupyterlab-lsp)
        @jupyter-widgets/jupyterlab-sidecar v0.6.1 disabled OK (python, sidecar)
        @jupyter-widgets/jupyterlab-manager v3.1.0 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: ../envs/x/share/jupyter/lab

Disabled extensions:
    @jupyter-widgets/jupyterlab-sidecar (all plugins)
    @krassowski/jupyterlab-lsp:hover

The following source extensions are overshadowed by older prebuilt extensions:
    nbdime-jupyterlab

```

Would you mind opening an issue on [Issues · jupyterlab/jupyterlab · GitHub](https://github.com/jupyterlab/jupyterlab/issues) with a reproducible example (minimal code of the ` @cdanner/lab-extension:hide-menu-plugin` plugin that is necessary to reproduce and step-by-step instructions).

---

<div class="post-metadata">

### Author: ![cdanner](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/cdanner/32/7739_2.png) [@cdanner](https://discourse.jupyter.org/u/cdanner)
#### Post date: [August 19, 2022, 12:42pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/8 "2022-08-19T12:42:59Z")

</div>

Sure, and thanks for your response!

---

<div class="post-metadata">

### Author: ![mcrutch](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mcrutch/32/2788_2.png) [@mcrutch](https://discourse.jupyter.org/u/mcrutch)
#### Post date: [August 19, 2022, 3:25pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/9 "2022-08-19T15:25:48Z")

</div>

I stared at this and stared at this, and FINALLY saw the problem in mine (one says gallery, one says nbgallery) so…yeah, time to patch the extensions so the plugin ids are correct.  
for those looking for more detail, my package.json has one name and the plugin id in the package was a _slightly_ different name in most of my packages. the package.json value is what is displayed in the jupyter labextension list, not hte plugin id, but if you disable with a string that matches the plugin id it won’t show up in the labextension list but will be disabled.

---

<div class="post-metadata">

### Author: ![cdanner](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/cdanner/32/7739_2.png) [@cdanner](https://discourse.jupyter.org/u/cdanner)
#### Post date: [September 9, 2022, 1:51pm UTC](https://discourse.jupyter.org/t/pre-built-extensions-and-labextension-disable-not-working/15318/10 "2022-09-09T13:51:06Z")

</div>

@mcrutch, thanks for pointing this out. I never would’ve checked the `package.json` file. I think the way an error like this creeps in is that – or at least what happened for me – is that I typed in one name for the project when filling out the fields from cookie-cutter, then later on decided to change the name of the plugins and changed it in the .ts file but don’t realize it needed to be changed in the `package.json` file too.

I modified my plugin names to start with `@` because I saw that RetroLab and JupyterLab were doing that. I just checked the RetroLab `package.json`, and the name in there starts with `@`, so um, I guess that’s important, haha.

But it turns out that wasn’t the only problem with my plugin naming. Another thing I copied from RetroLab and JupyterLab was that their plugins are named like `@retrolab/lab-extension:launch-retrotree`. I copied that pattern in naming my plugins, and apparently having the `/lab-extension` was also a problem for me. I got rid of the `@` and the `/lab-extension` in my plugin names, and now `jupyter labextension list` is working for me.

It’s super weird that the actual enable disable of the plugin behaviors was working this whole time even when `jupyter labextension list` didn’t reflect that though.
