First, thanks to all the TLJH contributors, I’ve found it a really helpful tool.
I would like to publish an extension (ipympl) to all my TLJH users. There are docs that explain how to install extensions globally, but the instructions are not working for me: the “jupyter contrib” command fails with:
File "/opt/tljh/user/lib/python3.10/site-packages/jupyter_contrib_core/notebook_compat/nbextensions.py", line 6, in <module>
from notebook.extensions import BaseExtensionApp
ModuleNotFoundError: No module named 'notebook.extensions'
Are those instructions still accurate, or am I barking up the wrong tree? Should I instead be using “sudo -E pip install” to make extensions globally available?
Here are the versions I’m running, if that helps.
jupyter_client 8.6.3
jupyter_contrib_core 0.4.2
jupyter_contrib_nbextensions 0.7.0
jupyter_core 5.7.2
jupyter-events 0.12.0
jupyter-highlight-selected-word 0.2.0
jupyter-lsp 2.2.5
jupyter_nbextensions_configurator 0.6.4
jupyter-resource-usage 1.1.0
jupyter_server 2.15.0
jupyter_server_terminals 0.5.3
jupyter-telemetry 0.1.0
jupyterhub 5.2.1
jupyterlab 4.3.5
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.3
jupyterlab_widgets 3.0.13
notebook 7.3.2
I think you are mistaken about what specific extensions are involved.
The place you link in the documentation is talking about the extensions is specifically referring to the ’ Unofficial Jupyter Notebook Extensions’ / jupyter_contrib_nbextensions
ones. Indeed the very first link on that page is to here. These are mostly outdated as they only work with NbClassic (or really old versions of Jupyter Notebook) at this time.
ipympl is not among those.
ipympl is for Jupyter Notebook 7+ and current JupyterLab.
It installs in the same way a package should now. (I think the correct term is ‘pre-built “federated” extension’?)
Overall, this may need to be made clearer in the documentation as a lot has changed in the last couple of years. I haven’t installed TLJH very recently and so I don’t actually know what versions it gets by default, but from what you supplied you are clearly using modern tech and for ipympl
you wouldn’t need the jupyter_contrib_nbextensions
stuff.
One thing about ipympl
installing/updating:
Make sure you do a hard refresh on on page you tried before. It makes a lot of changes to browser-related things that aren’t necessarily propagated fully unless you trigger it.
The easier way is to try a fresh computer or browser after installing & restarting everything, including the machine. Often the computer you tried the pages on in the past can mislead you without additional steps.
1 Like
Thank you very much for your help! I admit I am new to the jupyterlab/hub ecosystem and unaware of a lot of its history, so got tripped up on terminology.
In the past, I had tried just installing via ‘sudo -E pip install ipympl’ and thought it didn’t work…because, as you pointed out, the ipympl changes didn’t appear right away. I just tried again, followed by a reboot of the server, and now it works!
Presumably a full reboot is overkill, and there’s some less-invasive way to get the extension to appear…but I’m just glad to have it working. Thanks again!
Maybe someone with more knowledge about installing an extension like ipympl
on a hub will chime in?
Was it just that it wasn’t working or wasn’t listed as installed? Other federated extensions will likely work sooner.
Is it possible the changes not appearing right away was on the machine you were accessing the hub with?
Thanks for the response! Once I installed ipympl via pip, I logged on a different user, and did not see it in the extensions list (even after a hard refresh of the browser). Thinking that maybe it was in fact installed, but simply not showing up, I also made a new notebook with the magic command “%matplotlib ipympl”, and that cell failed.
Then I rebooted the server, logged in as the same user…and that same notebook worked, and the extension appeared.
Anyway, in my case, rebooting is not very disruptive, so it’s a perfectly acceptable solution.
1 Like