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

Error displaying widget: model not found #504

Closed
afonit opened this issue Feb 12, 2020 · 7 comments
Closed

Error displaying widget: model not found #504

afonit opened this issue Feb 12, 2020 · 7 comments

Comments

@afonit
Copy link

afonit commented Feb 12, 2020

os: windows
Anaconda as package provider
Name Version Build Channel
jupyterlab 1.2.6 py_0 conda-forge
ipyleaflet 0.12.2 py37_0 conda-forge

For the jupyterlab extension:
jupyter-leaflet v0.12.1 enabled ok

I used to be able to use this - updated, and now I get:
Error displaying widget: model not found

Just doing one of the provided examples:

from ipyleaflet import Map, basemaps, basemap_to_tiles

m = Map(
    layers=(basemap_to_tiles(basemaps.NASAGIBS.ModisTerraTrueColorCR, "2017-04-08"), ),
    center=(52.204793, 360.121558),
    zoom=4
)

m

When I look in the web console I get messages like:

manager-base.js:273 Could not instantiate widget
(anonymous) @ manager-base.js:273
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
rejected @ manager-base.js:17
Promise.then (async)
step @ manager-base.js:18
(anonymous) @ manager-base.js:19
push.hs2k.__awaiter @ manager-base.js:15
push.hs2k.ManagerBase._make_model @ manager-base.js:257
(anonymous) @ manager-base.js:246
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
(anonymous) @ manager-base.js:19
push.hs2k.__awaiter @ manager-base.js:15
push.hs2k.ManagerBase.new_model @ manager-base.js:232
push.hs2k.ManagerBase.handle_comm_open @ manager-base.js:144
WidgetManager._handleCommOpen @ manager.js:59
_handleCommOpen @ default.js:995
async function (async)
_handleCommOpen @ default.js:994
_handleMessage @ default.js:1101
async function (async)
_handleMessage @ default.js:1067
(anonymous) @ default.js:122
Promise.then (async)
DefaultKernel._onWSMessage @ default.js:119
utils.js:119 Error: Could not create a model.
    at promiseRejection (utils.js:119)
    at async WidgetManager._handleCommOpen (manager.js:59)
    at async DefaultKernel._handleCommOpen (default.js:995)
    at async DefaultKernel._handleMessage (default.js:1101)
promiseRejection @ utils.js:119
Promise.catch (async)
push.hs2k.ManagerBase.handle_comm_open @ manager-base.js:149
WidgetManager._handleCommOpen @ manager.js:59
_handleCommOpen @ default.js:995
async function (async)
_handleCommOpen @ default.js:994
_handleMessage @ default.js:1101
async function (async)
_handleMessage @ default.js:1067
(anonymous) @ default.js:122
Promise.then (async)
DefaultKernel._onWSMessage @ default.js:119
default.js:1001 Exception opening new comm
_handleCommOpen @ default.js:1001
async function (async)
_handleCommOpen @ default.js:994
_handleMessage @ default.js:1101
async function (async)
_handleMessage @ default.js:1067
(anonymous) @ default.js:122
Promise.then (async)
DefaultKernel._onWSMessage @ default.js:119
default.js:127 Error: Module jupyter-leaflet, semver range ^0.12.2 is not registered as a widget module
    at WidgetManager.loadClass (manager.js:251)
    at WidgetManager.<anonymous> (manager-base.js:263)
    at step (manager-base.js:44)
    at Object.next (manager-base.js:25)
    at manager-base.js:19
    at new Promise (<anonymous>)
    at push.hs2k.__awaiter (manager-base.js:15)
    at WidgetManager.push.hs2k.ManagerBase._make_model (manager-base.js:257)
    at WidgetManager.<anonymous> (manager-base.js:246)
    at step (manager-base.js:44)
(anonymous) @ default.js:127
Promise.catch (async)
DefaultKernel._onWSMessage @ default.js:124
manager-base.js:273 Could not instantiate widget
(anonymous) @ manager-base.js:273
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
rejected @ manager-base.js:17
Promise.then (async)
step @ manager-base.js:18
(anonymous) @ manager-base.js:19
push.hs2k.__awaiter @ manager-base.js:15
push.hs2k.ManagerBase._make_model @ manager-base.js:257
(anonymous) @ manager-base.js:246
step @ manager-base.js:44
(anonymous) @ manager-base.js:25
(anonymous) @ manager-base.js:19
push.hs2k.__awaiter @ manager-base.js:15
push.hs2k.ManagerBase.new_model @ manager-base.js:232
push.hs2k.ManagerBase.handle_comm_open @ manager-base.js:144
WidgetManager._handleCommOpen @ manager.js:59
_handleCommOpen @ default.js:995
async function (async)
_handleCommOpen @ default.js:994
_handleMessage @ default.js:1101
async function (async)
_handleMessage @ default.js:1067
(anonymous) @ default.js:122
Promise.then (async)
DefaultKernel._onWSMessage @ default.js:119
utils.js:119 Error: Could not create a model.
    at promiseRejection (utils.js:119)
    at async WidgetManager._handleCommOpen (manager.js:59)
    at async DefaultKernel._handleCommOpen (default.js:995)
    at async DefaultKernel._handleMessage (default.js:1101)
promiseRejection @ utils.js:119
Promise.catch (async)
push.hs2k.ManagerBase.handle_comm_open @ manager-base.js:149
WidgetManager._handleCommOpen @ manager.js:59
_handleCommOpen @ default.js:995
async function (async)
_handleCommOpen @ default.js:994
_handleMessage @ default.js:1101
async function (async)
_handleMessage @ default.js:1067
(anonymous) @ default.js:122
Promise.then (async)
DefaultKernel._onWSMessage @ default.js:119
default.js:1001 Exception opening new comm
@martinRenou
Copy link
Member

martinRenou commented Feb 13, 2020

Did you try (re)installing the ipywidgets extension?

jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet

@afonit
Copy link
Author

afonit commented Feb 13, 2020

It did not occur to me that might be a problem as ipywidgets worked fine.

Just did what you suggested, that - build completed.
I still get the error:

Error displaying widget: model not found

default.js:127 Error: Module jupyter-leaflet, semver range ^0.12.2 is not registered as a widget module
    at C.loadClass (manager.js:305)
    at C.<anonymous> (manager-base.js:263)
    at l (manager-base.js:44)
    at Object.next (manager-base.js:25)
    at manager-base.js:19
    at new Promise (<anonymous>)
    at Rtm6.L (manager-base.js:15)
    at C.e._make_model (manager-base.js:257)
    at C.<anonymous> (manager-base.js:246)
    at l (manager-base.js:44)
(anonymous) @ default.js:127
manager-base.js:273 Could not instantiate widget
(anonymous) @ manager-base.js:273
utils.js:119 Error: Could not create a model.
    at n (utils.js:119)
    at async C._handleCommOpen (manager.js:61)
    at async v._handleCommOpen (default.js:994)
    at async v._handleMessage (default.js:1100)

then I did the rebuild specifically of

jupyter labextension install jupyter-leaflet

Then it worked - thank you for your suggestions and help.

@afonit afonit closed this as completed Feb 13, 2020
@jhgoebbert
Copy link

I have the same problem.
We changed our setup from 0.11.4 to 0.12.3 and now we get the error "Error displaying widget: model not found" with the error message:
Error: "Module jupyter-leaflet, semver range ^0.12.3 is not registered as a widget module"
in the Web-Console.

@martinRenou
Copy link
Member

Hello. Are you using JupyterLab or Jupyter Notebook? If using JupyterLab, did you try reinstalling the labextensions jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet?

@jhgoebbert
Copy link

Hello Martin,

thank you for the reply. We have a juypter installation of our users of the hpc resources of the jsc supercomputing resources. Because of the different use-cases it has to consider, the list of extensions and packages is quite long. In general all extensions of jupyterlab work nicely together, but jupyter-leaflet does not since the last update our jupyter software stack.

This is part of our easybuild-script for the jupyter module. You can see, that I have to install jupyter-leaflet a second time to make it work:

    ### JupyterLab Extensions
    'source %(builddir)s/env.sh && jupyter labextension install @jupyter-widgets/jupyterlab-manager@1.1.0 --no-build', # Jupyter widgets extension
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-datawidgets@6.2.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install dask-labextension@1.1.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @jupyterlab/server-proxy@2.0.0 --no-build', # MUST be > 1.1.0 #  provide launcher icons for registered server processes
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-lmod@0.2.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install itkwidgets@0.26.0 --no-build', # installation lets jupyterlab-plotly and/or dask-labextension FAIL with "Error: Can't resolve 'es6-promise/auto'"
    'source %(builddir)s/env.sh && jupyter labextension install plotlywidget@1.5.2 --no-build',      # FigureWidget support of plotly
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-plotly@1.5.2 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @jupyterlab/latex@1.0.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @pyviz/jupyterlab_pyviz@0.8.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyter-matplotlib@0.5.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyter-leaflet@0.12.3 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyter-webrtc@0.5.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install ipyvolume@0.5.2 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyter-threejs@2.1.1 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyter-vuetify@1.1.1 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install bqplot@0.5.3 --no-build', # compatible with python package bqplot 0.12.3
    'source %(builddir)s/env.sh && jupyter labextension install pvlink@0.2.3 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @bokeh/jupyter_bokeh@1.1.1 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-gitlab@0.3.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab_iframe@0.2.1 --no-build', # js-version 0.1.9 fits to python-extension 0.1.11

    # jupyterlab extensions known to be fancy
    'source %(builddir)s/env.sh && jupyter labextension install @jupyterlab/git@0.8.2 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install nbdime-jupyterlab@1.0.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @ryantam626/jupyterlab_code_formatter@0.6.1 --no-build', # pip install jupyterlab_code_formatter, black==19.3b0 && yapf==0.28.0 && autopep8==1.4.4
    'source %(builddir)s/env.sh && jupyter labextension install @jupyterlab/toc@1.0.1 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @jupyter-widgets/jupyterlab-sidecar@0.4.0 --no-build', # pip install sidecar
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-drawio@0.6.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @jupyterlab/celltags@0.2.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @krassowski/jupyterlab_go_to_definition@0.7.1 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install @jupyter-voila/jupyterlab-preview@0.1.3 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-dash@0.1.0-alpha.3 --no-build',

    # logout button
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-topbar-extension@0.4.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-system-monitor@0.4.1 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-theme-toggle@0.4.2 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-logout@0.4.0 --no-build',
    'source %(builddir)s/env.sh && jupyter labextension install jupyterlab-control@1.0.1 --no-build',

    ## build JupyterLab app directory for all previous installed extensions in one go
    'source %(builddir)s/env.sh && jupyter lab build --dev-build=False',

    # needs to be build a second time - https://github.com/jupyter-widgets/ipyleaflet/issues/504
    'source %(builddir)s/env.sh && jupyter labextension install jupyter-leaflet@0.12.3 ',

@jhgoebbert
Copy link

And to answer your question. Yes, it works now, by installing it twice. (see above)

@dahlalex
Copy link

dahlalex commented Mar 6, 2022

I'm working on Windows 11. After creating the virtual environment and installing all the required packages, I couldn't import leafmap modul in jupyter notebook. The solution was by installing ipykernel. Here is a video from youtube that explaining this: How To Use Python Virtual Environment And Jupyter Notebook

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

4 participants