jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.15k stars 949 forks source link

ipywidgets not renderering without a kernel #3773

Open jgunstone opened 1 year ago

jgunstone commented 1 year ago

Description

image

Reproduce

import ipywidgets as w

w.VBox([
    w.Text(), 
    w.Textarea(), 
    w.IntText(), 
    w.IntSlider(), 
    w.IntRangeSlider()
])

then shutdown the kernel and reopen the notebook. you will see the image above

Expected behavior

expect to see the HTML widgets as preview (though I understand there is no control other jslink without the kernel)

image

Context

wsl - ubuntu2004 chrome

tried in both the envs listed below:

env1

ipywidgets 8.0.4 pyhd8ed1ab_0 conda-forge JupyterLab v3.4.4 /home/jovyan/mambaforge/envs/ipyautoui-dev/share/jupyter/labextensions bqplot v0.5.37 enabled OK (python, bqplot) jupyter-vuetify v1.8.4 enabled OK ipydatagrid v1.1.14 enabled OK jupyterlab-plotly v5.9.0 enabled OK jupyter-vue v1.8.0 enabled OK jupyterlab-jupytext v1.3.8+dev enabled OK (python, jupytext) @jupyter-widgets/jupyterlab-manager v5.0.5 enabled OK (python, jupyterlab_widgets) @voila-dashboards/jupyterlab-preview v2.2.0 enabled OK (python, voila) @telamonian/theme-darcula v4.0.0 enabled OK (python, theme-darcula) @krassowski/jupyterlab-lsp v3.10.2 enabled OK (python, jupyterlab-lsp)

env2

ipywidgets 8.0.6 pypi_0 pypi JupyterLab v4.0.0 /home/jovyan/mambaforge/envs/document-issue-dev/share/jupyter/labextensions jupyterlab_pygments v0.2.2 enabled X (python, jupyterlab_pygments) bqplot v0.5.40 enabled X (python, bqplot) jupyter-vuetify v1.8.10 enabled X ipydatagrid v1.1.15 enabled X jupyter-vue v1.9.0 enabled OK jupyterlab-jupytext v1.3.8+dev enabled X (python, jupytext) @jupyter-widgets/jupyterlab-manager v5.0.7 enabled X (python, jupyterlab_widgets)

paddymul commented 1 year ago

From the call I understand that there was a change in behavior for this saving widget state between Jupyterlab and Jupyter notebook. Where was that change documented, and the reasoning behind it (I would imagine in a Jupyterlab changelog).

Now imagine the experience from a user of Jupyter. The core widgets team understands why this might have stopped working, but that user won't. The current message is unhelpful, "Error displaying widget: model not found".

As a developer I would want a message listing the model name being searched for, and the models that are available to be loaded.

As a user, the context of why the model can't be found should be shown. If this is the desired behavior of JupyterLab, this isn't an error... but a message along the lines of "JupyterLab doesn't persist model state between saves because ???, to see this widget output re-execute the above cell".