Skip to content

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

Open

Description

@nvaytet

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)

Activity

  1. 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[/+] on Jun 29, 2022
  2. martinRenou commented on Jun 29, 2022

    @martinRenou
    Member

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

  3. nvaytet commented on Jun 29, 2022

    @nvaytet
    Author

    Which version should I try?

  4. martinRenou commented on Jun 29, 2022

    @martinRenou
    Member

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

  5. martinRenou commented on Jun 29, 2022

    @martinRenou
    Member

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

  6. nvaytet commented on Jun 30, 2022

    @nvaytet
    Author

    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

  7. nvaytet commented on Jun 30, 2022

    @nvaytet
    Author

    Ah, version 3.0.0 works!

  8. nvaytet commented on Jun 30, 2022

    @nvaytet
    Author

    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

  9. martinRenou commented on Jun 30, 2022

    @martinRenou
    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.

  10. nvaytet commented on Jun 30, 2022

    @nvaytet
    Author

    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?

  11. jklymak commented on Jul 7, 2022

    @jklymak
    Member

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

  12. davidfokkema commented on Jan 9, 2023

    @davidfokkema

    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.

  13. petrovfedor commented on Jan 13, 2023

    @petrovfedor

    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.

  14. petrovfedor commented on Jan 13, 2023

    @petrovfedor

    Just tested this with 3.5.0 and it works.

  15. jklymak commented on Mar 2, 2023

    @jklymak
    Member

    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.

  16. lrlunin commented on Jun 15, 2023

    @lrlunin

    Not working in the jupyterlab 3.6.4 either.

  17. vincefn commented on May 25, 2024

    @vincefn

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions