Here’s the scenario: I’m in JupyterLab. I create a notebook that displays a widget. I save the notebook, close it, shut down the kernel.
Sometime later I come back and reopen the notebook. The widget reconstitutes itself from the model and displays (albeit with the “disconnected from kernel” icon). So far everything is good. But here’s where the problem starts…
I save the notebook again, close it and shut the kernel down. I don’t even need to change anything. The next time I open it up, the widget tries to reconstitute itself from the model, but instead I get an “Error displaying widget: model not found” message.
Sure enough, I open up the ipynb in a json editor and can see that the cell has an
application/vnd.jupyter.widget-view+json output with a
model_id, but no corresponding model with that id is to be found in the metadata.
My question is: Is this a bug? Or is this a by design part of the widget framework, because at the point where the notebook was saved the second time, the widget wasn’t connected to the kernel?