ipympl icon indicating copy to clipboard operation
ipympl copied to clipboard

Still getting "Model not found" error instead of static figure when saving and re-opening the notebook

Open nvaytet opened this issue 3 years ago • 16 comments

Hi, unfortunately, I am still seeing this error after re-opening the notebook. Screenshot at 2022-06-29 16-31-42

The console log from Chrome: Screenshot at 2022-06-29 16-33-54

Versions:

jupyter_client            7.3.1              pyhd8ed1ab_0    conda-forge
jupyter_core              4.10.0           py39hf3d152e_0    conda-forge
jupyter_server            1.17.0             pyhd8ed1ab_0    conda-forge
jupyterlab                3.4.2              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.14.0             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        1.1.0              pyhd8ed1ab_0    conda-forge

matplotlib                3.5.2            py39hf3d152e_0    conda-forge
matplotlib-base           3.5.2            py39h700656a_0    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge

ipydatawidgets            4.3.1.post1        pyhc268e32_0    conda-forge
ipykernel                 6.13.0           py39hef51801_0    conda-forge
ipympl                    0.9.1              pyhd8ed1ab_0    conda-forge
ipython                   8.4.0            py39hf3d152e_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.7.0              pyhd8ed1ab_0    conda-forge

Thanks for any help!

Originally posted by @nvaytet in https://github.com/matplotlib/ipympl/issues/343#issuecomment-1170066433

nvaytet avatar Jun 29 '22 14:06 nvaytet

Mmh I'm wondering if something has changed in JupyterLab recently that causes this. Would you be able to try to downgrade JupyterLab?

martinRenou avatar Jun 29 '22 14:06 martinRenou

Which version should I try?

nvaytet avatar Jun 29 '22 18:06 nvaytet

Sorry I didn't mean to close this issue 😕 maybe 3.0?

martinRenou avatar Jun 29 '22 19:06 martinRenou

Looks like I'm not the only one closing issues unintentionally https://twitter.com/choldgraf/status/1542169522282860550?s=20&t=7WHeO5lmM8dD62HwB5qHsg

martinRenou avatar Jun 29 '22 19:06 martinRenou

I am still getting the "Model not found" error in Jupyterlab=3.0.18

272.3fcd6d7045eecfb56da6.js:1 Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm was closed too early
(anonymous) @ 272.3fcd6d7045eecfb56da6.js:1
(anonymous) @ 272.3fcd6d7045eecfb56da6.js:1
(anonymous) @ 272.3fcd6d7045eecfb56da6.js:1
a @ 272.3fcd6d7045eecfb56da6.js:1
Promise.then (async)
l @ 272.3fcd6d7045eecfb56da6.js:1
s @ 272.3fcd6d7045eecfb56da6.js:1
Promise.then (async)
l @ 272.3fcd6d7045eecfb56da6.js:1
(anonymous) @ 272.3fcd6d7045eecfb56da6.js:1
D @ 272.3fcd6d7045eecfb56da6.js:1
e._loadFromKernel @ 272.3fcd6d7045eecfb56da6.js:1
_loadFromKernel @ 523.66fca84c7924f6f7676d.js:1
await in _loadFromKernel (async)
restoreWidgets @ 523.66fca84c7924f6f7676d.js:1
x @ 523.66fca84c7924f6f7676d.js:1
L @ 523.66fca84c7924f6f7676d.js:1
(anonymous) @ 523.66fca84c7924f6f7676d.js:1
m @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
l @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
e.emit @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
(anonymous) @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
m @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
l @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
e.emit @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
add @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
await in add (async)
add @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
add @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
(anonymous) @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
m @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
l @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
e.emit @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
createNew @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
createWidget @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
_createOrOpenDocument @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
open @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
openOrReveal @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
_handleOpen @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
_evtDblClick @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
handleEvent @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
523.66fca84c7924f6f7676d.js:1 Error: widget model not found
    at x.get_model (523.66fca84c7924f6f7676d.js:1:6292)
    at u.renderModel (523.66fca84c7924f6f7676d.js:1:972)
renderModel @ 523.66fca84c7924f6f7676d.js:1
await in renderModel (async)
_rerender @ 523.66fca84c7924f6f7676d.js:1
m @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
l @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
e.emit @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
restoreWidgets @ 523.66fca84c7924f6f7676d.js:1
await in restoreWidgets (async)
x @ 523.66fca84c7924f6f7676d.js:1
L @ 523.66fca84c7924f6f7676d.js:1
(anonymous) @ 523.66fca84c7924f6f7676d.js:1
m @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
l @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
e.emit @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
(anonymous) @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
m @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
l @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
e.emit @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
add @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
await in add (async)
add @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
add @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
(anonymous) @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
m @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
l @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
e.emit @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
createNew @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
createWidget @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
_createOrOpenDocument @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
open @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
openOrReveal @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
_handleOpen @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
_evtDblClick @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2
handleEvent @ jlab_core.8e0f8627d52a54fc21fe.js?v=8e0f8627d52a54fc21fe:2

Screenshot at 2022-06-30 10-49-52

nvaytet avatar Jun 30 '22 08:06 nvaytet

Ah, version 3.0.0 works!

nvaytet avatar Jun 30 '22 08:06 nvaytet

Another question: is it at all possible to obtain the same behaviour if the figure is placed inside another (e.g. VBox) widget? Thanks!

Screenshot at 2022-06-30 10-55-47

nvaytet avatar Jun 30 '22 08:06 nvaytet

Ah, version 3.0.0 works!

Interesting! So something has changed between 3.0.0 and 3.0.18 that prevents it from displaying the image repr...

Another question: is it at all possible to obtain the same behaviour if the figure is placed inside another (e.g. VBox) widget?

This might be difficult, if the VBox cannot be displayed then we cannot do much about it. Also the VBox embeds the widget representation of the plot, not the image one.

martinRenou avatar Jun 30 '22 09:06 martinRenou

What's interesting is:

  • I first run the notebook using 3.0.0, save it, re-open it and I still see the figure.
  • then I go back to a higher version of lab (3.0.18 or even 3.4)
  • open that same saved notebook, all of a sudden I can see the figure

I am guessing the png repr is correctly being saved by 3.0.0 (I don't know exactly which version broke between 3.0.0 and 3.0.18 yet), and then it can be loaded by later versions.

So this would mean that versions 3.0.18 and higher are failing to save the png rather than load it?

nvaytet avatar Jun 30 '22 13:06 nvaytet

I can confirm that downgrading (mamba install jupyterlab=3.0.0) also fixes this issue for me.

jklymak avatar Jul 07 '22 07:07 jklymak

Can confirm that jupyterlab 3.0.0 does work and that jupyterlab 3.5.2 does not work. Also: the problem seems to be in saving the notebook. A simple notebook saved with 3.0.0 opens with a static image in 3.5.2.

davidfokkema avatar Jan 09 '23 10:01 davidfokkema

I can confirm @davidfokkema. That 3.0.0 works and 3.5.2 not. Moreover in our case we use widgets with asynchronous calls. And this problem leads to widgets disappearing from the notebook approximately after one minute idle.

petrovfedor avatar Jan 13 '23 11:01 petrovfedor

Just tested this with 3.5.0 and it works.

petrovfedor avatar Jan 13 '23 12:01 petrovfedor

I get "Error displaying widget: model not found" with the following env (and jupyterlab 3.6.1):

$ mamba list jupyterlab
# packages in environment at /Users/jklymak/mambaforge/envs/LP22a:
#
# Name                    Version                   Build  Channel
jupyterlab                3.5.0              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.19.0             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.5              pyhd8ed1ab_0    conda-forge
(LP22a)
# jklymak @ quadra in ~/Dropbox/LP22a [16:05:37]
$ mamba list ipympl
# packages in environment at /Users/jklymak/mambaforge/envs/LP22a:
#
# Name                    Version                   Build  Channel
ipympl                    0.9.3              pyhd8ed1ab_0    conda-forge
(LP22a)

jupyterlab 3.0.0 works though.

jklymak avatar Mar 02 '23 00:03 jklymak

Not working in the jupyterlab 3.6.4 either.

lrlunin avatar Jun 15 '23 15:06 lrlunin