Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nvaytet opened this issue Jun 29, 2022 · 16 comments

Comments

@nvaytet
Copy link

nvaytet commented Jun 29, 2022

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 #343 (comment)

@nvaytet nvaytet changed the title Still getting "Model not found error instead of static figure when saving and re-opening the notebook Still getting "Model not found" error instead of static figure when saving and re-opening the notebook Jun 29, 2022
@martinRenou
Copy link
Member

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

@nvaytet
Copy link
Author

nvaytet commented Jun 29, 2022

Which version should I try?

@martinRenou
Copy link
Member

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

@martinRenou martinRenou reopened this Jun 29, 2022
@martinRenou
Copy link
Member

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

@nvaytet
Copy link
Author

nvaytet commented Jun 30, 2022

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
Copy link
Author

nvaytet commented Jun 30, 2022

Ah, version 3.0.0 works!

@nvaytet
Copy link
Author

nvaytet commented Jun 30, 2022

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

@martinRenou
Copy link
Member

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.

@nvaytet
Copy link
Author

nvaytet commented Jun 30, 2022

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?

@jklymak
Copy link
Member

jklymak commented Jul 7, 2022

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

@davidfokkema
Copy link

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.

@petrovfedor
Copy link

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
Copy link

Just tested this with 3.5.0 and it works.

@jklymak
Copy link
Member

jklymak commented Mar 2, 2023

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.

@lrlunin
Copy link

lrlunin commented Jun 15, 2023

Not working in the jupyterlab 3.6.4 either.

@vincefn
Copy link

vincefn commented May 25, 2024

This is a bit old, but I just ran into this with a fresh installation of ipympl (0.9.4) & jupyter-lab (4.2.1).

However there is now a jupyter-lab menu Settings->Save Widget State Automatically which resolved this. Now the plots (the embedded png) are correctly displayed after re-opening a shutdown'd notebook. And it's also correctly displayed using nbsphinx as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants