matplotlib / ipympl

Matplotlib Jupyter Integration
https://matplotlib.org/ipympl/
BSD 3-Clause "New" or "Revised" License
1.59k stars 225 forks source link

Error: No version of module jupyter-matplotlib is registered #547

Closed 0xfeedbac closed 8 months ago

0xfeedbac commented 8 months ago

Describe the issue

After following the installation procedure (pretty much the pip install ipympl) and using the %matplotlib widget magic, an attempt to show a plot produces the following error:

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'MPLCanvasModel' from module 'jupyter-matplotlib'
Error: No version of module jupyter-matplotlib is registered
    at f.loadClass (http://100.101.30.95:8000/jupyter/user/ruslan/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js?v=fe2572ece3b7955c89bb:1:74933)
    at f.loadModelClass (http://100.101.30.95:8000/jupyter/user/ruslan/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:10728)
    at f._make_model (http://100.101.30.95:8000/jupyter/user/ruslan/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:7516)
    at f.new_model (http://100.101.30.95:8000/jupyter/user/ruslan/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:5136)
    at f.handle_comm_open (http://100.101.30.95:8000/jupyter/user/ruslan/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:3893)
    at _handleCommOpen (http://100.101.30.95:8000/jupyter/user/ruslan/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js?v=fe2572ece3b7955c89bb:1:73470)
    at b._handleCommOpen (http://100.101.30.95:8000/jupyter/user/ruslan/static/lab/jlab_core.7686966ed3d08bd5a5c5.js?v=7686966ed3d08bd5a5c5:1:1331675)
    at async b._handleMessage (http://100.101.30.95:8000/jupyter/user/ruslan/static/lab/jlab_core.7686966ed3d08bd5a5c5.js?v=7686966ed3d08bd5a5c5:1:1333665)

Versions

$ python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter labextension list # Jupyter command `jupyter-nbextension` not found.

 3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0]
ipympl version: 0.9.3
Selected Jupyter core packages...
IPython          : 8.20.0
ipykernel        : 6.28.0
ipywidgets       : 8.1.2
jupyter_client   : 8.6.0
jupyter_core     : 5.5.0
jupyter_server   : 2.12.5
jupyterlab       : 4.1.2
nbclient         : 0.9.0
nbconvert        : 7.16.1
nbformat         : 5.9.2
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.7.1
JupyterLab v4.1.2
/opt/conda/envs/tfmax/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        jupyter-matplotlib v0.11.3 enabled OK
        @jupyter-widgets/jupyterlab-manager v5.0.10 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: /opt/conda/envs/tfmax/share/jupyter/lab
martinRenou commented 8 months ago

Did you refresh the web page after the installation?

0xfeedbac commented 8 months ago

Did you refresh the web page after the installation?

I did, and rebooted the remote server where the jupyter is running to be sure.

martinRenou commented 8 months ago

Given your information it's difficult to understand what is wrong unfortunately.

You may want to check that you don't have multiple conflicting jupyter installed. Playing around with which jupyter and jupyter --paths commands to check what is your jupyter and where it looks for extensions.

0xfeedbac commented 8 months ago

You may want to check that you don't have multiple conflicting jupyter installed. Playing around with which jupyter and jupyter --paths commands to check what is your jupyter and where it looks for extensions.

This has been the problem indeed. There was one installation of Jupyter Hub which appears to be serving the browser window, and one in the current environment (I've tried to uninstall the latter with pip to avoid confusion in the future, but it appears to be needed, as without it cells outputs don't show). Anyway, the problem is now solved, thank you!

Just to have a reference for those who may face similar problem, here is the list of commands that I've run:

martinRenou commented 8 months ago

Thanks for reporting back with some more information! Glad you fixed it

pomergranate commented 1 month ago

I have encountered this problem too after installing the ipympl. However it isn't aroused by the jupyter conflict. Actually what I had done was just to restart the kernel and refresh my browser.