Reloading widget state in saved Jupyter notebooks

Hi, I’m using Jupyter notebook 7.0.3 and ipywidgets 8.1.0. When I create a Jupyter notebook that contains a widget and save the notebook, upon reopening the notebook the widget is not displayed with an error message saying “Error displaying widget: model not found”.

I have toggled on the “Save widget State Automatically” option under the menu bar option.

For example, if I just create an empty notebook with

import ipywidgets

when I run this cell during the session the sliding bar widget displays just fine. But when I save, close, and shutdown the notebook and later reopen it, I encounter this error. It appears as if the widget display cannot persist to be displayed outside an active kernel.

Could you help advise what went wrong and how to resolve? Thank you!!

1 Like

This is a known issue, but there does not seem to be any solution at this point other than using NBClassic. See Widget state not persisted after kernel restart · Issue #3758 · jupyter-widgets/ipywidgets · GitHub.


I can confirm that loading a widget is currently only possible in Notebook 6.5.4 and not in newer versions. I’ve made a feature request for JupyterLab here:

1 Like