matplotlib / ipympl

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

Version incompatibility #506

Open akhmerov opened 1 year ago

akhmerov commented 1 year ago

Describe the issue

I seem to observe the incompatibiltiy similar to one previously reported in #161: widget model not found and JS console with an error. This is using the latest versions of everything as far as I can tell.

Uncaught (in promise) Error: Module jupyter-matplotlib, semver range ^0.11 is not registered as a widget module

Versions

 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:26:04) [GCC 10.4.0]
ipympl version: 0.9.2
Selected Jupyter core packages...
IPython          : 8.7.0
ipykernel        : 6.19.2
ipywidgets       : 7.7.2
jupyter_client   : 7.4.8
jupyter_core     : 5.1.0
jupyter_server   : 1.23.3
jupyterlab       : 3.5.1
nbclient         : 0.5.13
nbconvert        : 6.5.3
nbformat         : 5.7.0
notebook         : 6.5.2
qtconsole        : not installed
traitlets        : 5.7.1
Known nbextensions:
  config dir: /opt/conda/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      jupyter_bokeh/extension  enabled 
      - Validating: OK
      jupyter_resource_usage/main  enabled 
      - Validating: OK
      jupyterlab-plotly/extension  enabled 
      - Validating: OK
      jupytext/index  enabled 
      - Validating: OK
      nbdime/index  enabled 
      - Validating: OK
      nbresuse/main  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
    tree section
      ipyparallel/main  enabled 
      - Validating: OK
      jupyter_server_proxy/tree  enabled 
      - Validating: OK
JupyterLab v3.5.1
/opt/conda/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        dask-labextension v6.0.0 enabled OK (python, dask_labextension)
        jupyterlab-topbar-extension v0.6.1 enabled OK (python, jupyterlab-topbar)
        jupyterlab-jupytext v1.3.8+dev enabled OK (python, jupytext)
        jupyter-matplotlib v0.11.2 enabled OK
        jupyterlab-link-share v0.2.4 enabled OK (python, jupyterlab-link-share)
        nbdime-jupyterlab v2.1.1 enabled OK
        ipyparallel-labextension v8.4.1 enabled OK
        jupyterlab-plotly v5.11.0 enabled OK
        jupyterlab-system-monitor v0.8.0 enabled OK (python, jupyterlab-system-monitor)
        @jupyter-widgets/jupyterlab-manager v3.1.1 enabled OK (python, jupyterlab_widgets)
        @jupyter-server/resource-usage v0.6.4 enabled OK (python, jupyter-resource-usage)
        @bokeh/jupyter_bokeh v3.0.5 enabled OK (python, jupyter_bokeh)
        @krassowski/jupyterlab-lsp v3.10.2 enabled OK (python, jupyterlab-lsp)
        @retrolab/lab-extension v0.3.21 enabled OK
        @jupyterlab/server-proxy v3.2.2 enabled OK
        @jupyterlab/latex v3.1.0 enabled OK (python, jupyterlab-latex)
        @jupyterlab/mathjax3-extension v4.3.0 enabled OK (python, jupyterlab-mathjax3)
        @jupyterlab/git v0.41.0 enabled OK (python, jupyterlab-git)
        @ryantam626/jupyterlab_code_formatter v1.5.3 enabled OK (python, jupyterlab-code-formatter)
        @pyviz/jupyterlab_pyviz v2.2.1 enabled OK (python, pyviz_comms)

Other labextensions (built into JupyterLab)
   app dir: /opt/conda/share/jupyter/lab
martinRenou commented 1 year ago

Thanks for opening an issue. Do you see another error in the JS console prior to the semver range ^0.11 is not registered one?

akhmerov commented 1 year ago

Ah, you're right! I see

image

martinRenou commented 1 year ago

Do you see core widgets working?

from ipywidgets import IntSlider
IntSlider()
akhmerov commented 1 year ago

Indeed, I did confirm that.

image

martinRenou commented 1 year ago

Mmmh I cannot reproduce your issue with ipywidgets=7.7.2 and ipympl=0.9.2, I also confirmed that I have the same labextension versions for jupyter-matplotlib and @jupyter-widgets/jupyterlab-manager, which is the minimum for ipympl to work.

I suspect one other installed labextension is breaking things up. Could you recreating your environment with less extensions to try to spot the culprit?

Irratzo commented 1 year ago

I can reproduce the "Error displaying widget: model not found" issue with ipywidgets=7.7.2 and ipympl=0.9.2. I also confirmed that I have the same labextension versions for jupyter-matplotlib and @jupyter-widgets/jupyterlab-manager.

Core widgets are working.

jupyter labextension list
JupyterLab v3.5.0
/opt/jupyterhub/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        bqplot v0.5.37 enabled OK (python, bqplot)
        jupyter-threejs v2.4.0 enabled OK (python, pythreejs)
        jupyterlab-datawidgets v7.1.2 enabled OK
        jupyterlab-jupytext v1.3.8+dev enabled OK (python, jupytext)
        nbdime-jupyterlab v2.1.1 enabled OK
        nglview-js-widgets v3.0.1 enabled OK
        jupyter-matplotlib v0.11.2 enabled OK
        @jupyter-widgets/jupyterlab-manager v3.1.1 enabled OK (python, jupyterlab_widgets)

Might downgrading ipywidgets be a solution?

haho16 commented 1 year ago

Hey all, I am experiencing similar issue. Here is my configuration:

JupyterLab v3.4.6
/venv/share/jupyter/labextensions
        jupyter-matplotlib v0.11.2 enabled OK
        jupyterlab-plotly v5.11.0 enabled OK
        jupyterlab-tour v3.1.4 enabled OK (python, jupyterlab-tour)
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        adh-jupyterlab-extension v0.1.0 enabled OK (python, adh-jupyterlab-extension)
        jupyterlab-tabular-data-editor v1.0.0 enabled OK (python, jupyterlab-tabular-data-editor)
        @jupyter-widgets/jupyterlab-manager v3.1.4 enabled OK (python, jupyterlab_widgets)
        @retrolab/lab-extension v0.3.21 enabled OK
        @voila-dashboards/jupyterlab-preview v2.1.6 enabled OK (python, voila)

Other labextensions (built into JupyterLab)
   app dir: /venv/share/jupyter/lab
        @j123npm/qgrid2 v1.1.4 enabled OK
        @plotly/dash-jupyterlab v0.4.3 enabled OK
        jupyterlab-dash v0.4.2 enabled OK
        jupyterlab-interactive-dashboard-editor v0.4.0 enabled OK
ipympl                    0.9.2              pyhd8ed1ab_0    conda-forge
ipywidgets                7.7.1              pyhd8ed1ab_0    conda-forge
matplotlib                3.5.3           py310hff52083_2    conda-forge

Was anyone able to resolve it?