jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.49k stars 363 forks source link

Browser console error: "jupyter.extensions.jupyter-leaflet failed to activate" #546

Open metasim opened 4 years ago

metasim commented 4 years ago

I'm configuring a JupyterLab (1.2.5) Docker environment, and I'm having a hard time getting ipyleaflet (0.12.3) to work consistently. When I create a simplified conda environment on my laptop with just JupyterLab, @jupyter-widgets/jupyterlab-manager and jupyter-leaflet, things work fine, but when I add in other libraries and plugins and deploy via a Docker image, ipyleaflet stops displaying maps, usually stuck on "Loading widget..." or "Error displaying widget: model not found" showing up in the notebook cell output, and the following in the browser (Chrome) console:

jupyter.extensions.jupyter-leaflet failed to activate ``` Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead. Error at A (http://localhost:8888/static/lab/vendors~main.8429b74936d96d40265a.js:1:418775) at Function.D.extend (http://localhost:8888/static/lab/vendors~main.8429b74936d96d40265a.js:1:417777) at Object.OTXi (http://localhost:8888/static/lab/vendors~main.8429b74936d96d40265a.js:1:2116586) at n (http://localhost:8888/static/lab/main.54def8d69479e21e7b9a.js:1:875) at Object.mGYY (http://localhost:8888/static/lab/vendors~main.8429b74936d96d40265a.js:1:3855130) at n (http://localhost:8888/static/lab/main.54def8d69479e21e7b9a.js:1:875) at Module.MIrW (http://localhost:8888/static/lab/vendors~main.8429b74936d96d40265a.js:1:1972447) at n (http://localhost:8888/static/lab/main.54def8d69479e21e7b9a.js:1:875) at Object.O3wJ (http://localhost:8888/static/lab/vendors~main.8429b74936d96d40265a.js:1:2106302) at n (http://localhost:8888/static/lab/main.54def8d69479e21e7b9a.js:1:875) A @ leaflet-src.js:400 ... index.js:267 Plugin 'jupyter.extensions.jupyter-leaflet' failed to activate. ... Error: No provider for: jupyter.extensions.jupyterWidgetRegistry. at f.e.resolveRequiredService (index.js:182) at index.js:140 at Array.map () at f.e.activatePlugin (index.js:140) at index.js:266 at Array.map () at f.e.start (index.js:265) at a (index.out.js:1553) ... Module jupyter-leaflet, semver range ^0.12.3 is not registered as a widget module at k.loadClass (manager.js:305 ```

(Note: other ipywidget components (buttons, sliders, etc.) work fine.)

To make matters more frustrating, if I force reinstall @jupyter-widgets/jupyterlab-manager and jupyter-leaflet from the JupyterLab terminal, hard reset the browser, and rerun the cells, sometimes the maps will show up. But not every time. :-/

I'm assuming that there's a version conflict with another library causing all this, but after a week of chopping the environment up I'm still no further along, and running out of ideas.

Any tips on additional things to try would be appreciated. Maybe a pointer to what role jupyter.extensions.jupyterWidgetRegistry plays and why it wouldn't be found by the notebook plugin.

Jupyter Conda Environment
$ conda env export
name: base
channels:
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=0_gnu
  - alembic=1.4.2=pyh9f0ad1d_0
  - async_generator=1.10=py_0
  - attrs=19.3.0=py_0
  - backcall=0.1.0=py_0
  - bleach=3.1.4=pyh9f0ad1d_0
  - blinker=1.4=py_1
  - branca=0.3.1=py_0
  - ca-certificates=2019.11.28=hecc5488_0
  - certifi=2019.11.28=py37hc8dfbb8_1
  - certipy=0.1.3=py_0
  - cffi=1.14.0=py37hd463f26_0
  - chardet=3.0.4=py37hc8dfbb8_1006
  - conda=4.8.3=py37hc8dfbb8_1
  - conda-package-handling=1.6.0=py37h8f50634_2
  - configurable-http-proxy=4.2.1=node13_he01fd0c_0
  - cryptography=2.8=py37hb09aad4_2
  - decorator=4.4.2=py_0
  - defusedxml=0.6.0=py_0
  - entrypoints=0.3=py37hc8dfbb8_1001
  - icu=64.2=he1b5a44_1
  - idna=2.9=py_1
  - importlib-metadata=1.6.0=py37hc8dfbb8_0
  - importlib_metadata=1.6.0=0
  - ipykernel=5.2.0=py37h43977f1_1
  - ipyleaflet=0.12.3=py_1
  - ipython=7.13.0=py37hc8dfbb8_2
  - ipython_genutils=0.2.0=py_1
  - ipywidgets=7.5.1=py_0
  - jedi=0.16.0=py37hc8dfbb8_1
  - jinja2=2.11.1=py_0
  - json5=0.9.0=py_0
  - jsonschema=3.2.0=py37hc8dfbb8_1
  - jupyter_client=6.1.2=py_0
  - jupyter_core=4.6.3=py37hc8dfbb8_1
  - jupyter_telemetry=0.0.5=py_0
  - jupyterhub=1.1.0=py37_2
  - jupyterhub-base=1.1.0=py37_2
  - jupyterlab=1.2.5=py_0
  - jupyterlab_server=1.1.0=py_0
  - krb5=1.16.4=h2fd8d38_0
  - ld_impl_linux-64=2.34=h53a641e_0
  - libblas=3.8.0=14_openblas
  - libcblas=3.8.0=14_openblas
  - libcurl=7.68.0=hda55be3_0
  - libedit=3.1.20170329=hf8c457e_1001
  - libffi=3.2.1=he1b5a44_1007
  - libgcc-ng=9.2.0=h24d8f2e_2
  - libgfortran-ng=7.3.0=hdf63c60_5
  - libgomp=9.2.0=h24d8f2e_2
  - liblapack=3.8.0=14_openblas
  - libopenblas=0.3.7=h5ec1e0e_6
  - libsodium=1.0.17=h516909a_0
  - libssh2=1.8.2=h22169c7_2
  - libstdcxx-ng=9.2.0=hdf63c60_2
  - libuv=1.34.0=h516909a_0
  - mako=1.1.0=py_0
  - markupsafe=1.1.1=py37h8f50634_1
  - mistune=0.8.4=py37h516909a_1000
  - nbconvert=5.6.1=py37_0
  - nbformat=5.0.4=py_0
  - ncurses=6.1=hf484d3e_1002
  - nodejs=13.10.1=hf5d1a2b_0
  - notebook=6.0.3=py37_0
  - numpy=1.18.1=py37h8960a57_1
  - oauthlib=3.0.1=py_0
  - openssl=1.1.1f=h516909a_0
  - pamela=1.0.0=py_0
  - pandas=1.0.3=py37h0da4684_0
  - pandoc=2.9.2=0
  - pandocfilters=1.4.2=py_1
  - parso=0.6.2=py_0
  - pexpect=4.8.0=py37hc8dfbb8_1
  - pickleshare=0.7.5=py37hc8dfbb8_1001
  - pip=20.0.2=py_2
  - prometheus_client=0.7.1=py_0
  - prompt-toolkit=3.0.5=py_0
  - ptyprocess=0.6.0=py_1001
  - pycosat=0.6.3=py37h8f50634_1004
  - pycparser=2.20=py_0
  - pycurl=7.43.0.5=py37h16ce93b_0
  - pygments=2.6.1=py_0
  - pyjwt=1.7.1=py_0
  - pyopenssl=19.1.0=py_1
  - pyrsistent=0.16.0=py37h8f50634_0
  - pysocks=1.7.1=py37hc8dfbb8_1
  - python=3.7.6=h8356626_5_cpython
  - python-dateutil=2.8.1=py_0
  - python-editor=1.0.4=py_0
  - python-json-logger=0.1.11=py_0
  - python_abi=3.7=1_cp37m
  - pytz=2019.3=py_0
  - pyzmq=19.0.0=py37hac76be4_1
  - readline=8.0=hf8c457e_0
  - requests=2.23.0=pyh8c360ce_2
  - ruamel.yaml=0.16.6=py37h8f50634_1
  - ruamel.yaml.clib=0.2.0=py37h8f50634_1
  - ruamel_yaml=0.15.80=py37h8f50634_1001
  - send2trash=1.5.0=py_0
  - setuptools=46.1.3=py37hc8dfbb8_0
  - six=1.14.0=py_1
  - sqlalchemy=1.3.15=py37h8f50634_1
  - sqlite=3.30.1=hcee41ef_0
  - terminado=0.8.3=py37hc8dfbb8_1
  - testpath=0.4.4=py_0
  - tini=0.18.0=h14c3975_1001
  - tk=8.6.10=hed695b0_0
  - tornado=6.0.4=py37h8f50634_1
  - tqdm=4.45.0=pyh9f0ad1d_0
  - traitlets=4.3.3=py37hc8dfbb8_1
  - traittypes=0.2.1=py_1
  - urllib3=1.25.7=py37hc8dfbb8_1
  - wcwidth=0.1.9=pyh9f0ad1d_0
  - webencodings=0.5.1=py_1
  - wheel=0.34.2=py_1
  - widgetsnbextension=3.5.1=py37_0
  - xarray=0.15.1=py_0
  - xz=5.2.4=h516909a_1002
  - yaml=0.2.2=h516909a_1
  - zeromq=4.3.2=he1b5a44_2
  - zipp=3.1.0=py_0
  - zlib=1.2.11=h516909a_1006
  - pip:
    - beautifulsoup4==4.8.2
    - bs4==0.0.1
    - jupyterlab-spark-ui-tab==0.0.2
    - soupsieve==2.0
prefix: /opt/conda
jupyter labextension list
$ jupyter labextension list
JupyterLab v1.2.5
Known labextensions:
   app dir: /opt/conda/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.1.0  enabled  OK
        jupyter-leaflet v0.12.3  enabled  OK
metasim commented 4 years ago

Some additional debugging...

FWIW. I got the error to occur in my local (MacOS) environment somehow, after a jupyter lab build and a refresh. Not just a Docker environment thing, pointing to some non-determinism in the startup sequence. The following might further support that theory,.

I set an exception breakpoint and note that the problem starts in Application.activatePlugin method from the @phosphor library, when it isjupyter.extensions.jupyter-leaflet turn to initialize. It comes at the end of a long list of plugins (below), but before @jupyter-widgets/jupyterlab-manager:plugin. Not sure if this means the system is attempting to initialize jupyter-leaflet before jupyterlab-manager, but that's the next thing to investigate, followed by what defines the initialization order.

Application._pluginMap

@jupyterlab/javascript-extension:factory: {id: "@jupyterlab/javascript-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/json-extension:factory: {id: "@jupyterlab/json-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/pdf-extension:factory: {id: "@jupyterlab/pdf-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/vega4-extension:factory: {id: "@jupyterlab/vega4-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/vega5-extension:factory: {id: "@jupyterlab/vega5-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application:mimedocument: {id: "@jupyterlab/application:mimedocument", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:main: {id: "@jupyterlab/application-extension:main", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:layout: {id: "@jupyterlab/application-extension:layout", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:router: {id: "@jupyterlab/application-extension:router", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:tree: {id: "@jupyterlab/application-extension:tree", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:notfound: {id: "@jupyterlab/application-extension:notfound", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:faviconbusy: {id: "@jupyterlab/application-extension:faviconbusy", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:sidebar: {id: "@jupyterlab/application-extension:sidebar", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:shell: {id: "@jupyterlab/application-extension:shell", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:status: {id: "@jupyterlab/application-extension:status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/application-extension:info: {id: "@jupyterlab/application-extension:info", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:paths: {id: "@jupyterlab/apputils-extension:paths", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:palette: {id: "@jupyterlab/apputils-extension:palette", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:palette-restorer: {id: "@jupyterlab/apputils-extension:palette-restorer", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:resolver: {id: "@jupyterlab/apputils-extension:resolver", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:settings: {id: "@jupyterlab/apputils-extension:settings", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:state: {id: "@jupyterlab/apputils-extension:state", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:splash: {id: "@jupyterlab/apputils-extension:splash", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:themes: {id: "@jupyterlab/apputils-extension:themes", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:themes-palette-menu: {id: "@jupyterlab/apputils-extension:themes-palette-menu", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:print: {id: "@jupyterlab/apputils-extension:print", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/codemirror-extension:commands: {id: "@jupyterlab/codemirror-extension:commands", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/codemirror-extension:services: {id: "@jupyterlab/codemirror-extension:services", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/codemirror-extension:editor-syntax-status: {id: "@jupyterlab/codemirror-extension:editor-syntax-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/completer-extension:manager: {id: "@jupyterlab/completer-extension:manager", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/completer-extension:consoles: {id: "@jupyterlab/completer-extension:consoles", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/completer-extension:notebooks: {id: "@jupyterlab/completer-extension:notebooks", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/completer-extension:files: {id: "@jupyterlab/completer-extension:files", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/console-extension:factory: {id: "@jupyterlab/console-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/console-extension:tracker: {id: "@jupyterlab/console-extension:tracker", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/console-extension:foreign: {id: "@jupyterlab/console-extension:foreign", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/csvviewer-extension:csv: {id: "@jupyterlab/csvviewer-extension:csv", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/csvviewer-extension:tsv: {id: "@jupyterlab/csvviewer-extension:tsv", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/docmanager-extension:plugin: {id: "@jupyterlab/docmanager-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/docmanager-extension:path-status: {id: "@jupyterlab/docmanager-extension:path-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/docmanager-extension:saving-status: {id: "@jupyterlab/docmanager-extension:saving-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/documentsearch:plugin: {id: "@jupyterlab/documentsearch:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/documentsearch:labShellWidgetListener: {id: "@jupyterlab/documentsearch:labShellWidgetListener", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/extensionmanager-extension:plugin: {id: "@jupyterlab/extensionmanager-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/filebrowser-extension:factory: {id: "@jupyterlab/filebrowser-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/filebrowser-extension:browser: {id: "@jupyterlab/filebrowser-extension:browser", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/filebrowser-extension:share-file: {id: "@jupyterlab/filebrowser-extension:share-file", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/filebrowser-extension:file-upload-status: {id: "@jupyterlab/filebrowser-extension:file-upload-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/fileeditor-extension:plugin: {id: "@jupyterlab/fileeditor-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/fileeditor-extension:tab-space-status: {id: "@jupyterlab/fileeditor-extension:tab-space-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/help-extension:plugin: {id: "@jupyterlab/help-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/htmlviewer-extension:plugin: {id: "@jupyterlab/htmlviewer-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
jupyter.extensions.hub-extension: {id: "jupyter.extensions.hub-extension", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/apputils-extension:connectionlost: {id: "@jupyterlab/apputils-extension:connectionlost", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/imageviewer-extension:plugin: {id: "@jupyterlab/imageviewer-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/inspector-extension:inspector: {id: "@jupyterlab/inspector-extension:inspector", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/inspector-extension:consoles: {id: "@jupyterlab/inspector-extension:consoles", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/inspector-extension:notebooks: {id: "@jupyterlab/inspector-extension:notebooks", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/launcher-extension:plugin: {id: "@jupyterlab/launcher-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/logconsole-extension:plugin: {id: "@jupyterlab/logconsole-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
logconsole:nboutput: {id: "logconsole:nboutput", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/mainmenu-extension:plugin: {id: "@jupyterlab/mainmenu-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/markdownviewer-extension:plugin: {id: "@jupyterlab/markdownviewer-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/mathjax2-extension:plugin: {id: "@jupyterlab/mathjax2-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/notebook-extension:factory: {id: "@jupyterlab/notebook-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/notebook-extension:tracker: {id: "@jupyterlab/notebook-extension:tracker", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/notebook-extension:tools: {id: "@jupyterlab/notebook-extension:tools", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/notebook-extension:mode-status: {id: "@jupyterlab/notebook-extension:mode-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/notebook-extension:trust-status: {id: "@jupyterlab/notebook-extension:trust-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/rendermime-extension:plugin: {id: "@jupyterlab/rendermime-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/running-extension:plugin: {id: "@jupyterlab/running-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/settingeditor-extension:plugin: {id: "@jupyterlab/settingeditor-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/shortcuts-extension:plugin: {id: "@jupyterlab/shortcuts-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/shortcuts-extension:shortcuts: {id: "@jupyterlab/shortcuts-extension:shortcuts", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/statusbar-extension:plugin: {id: "@jupyterlab/statusbar-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/statusbar-extension:line-col-status: {id: "@jupyterlab/statusbar-extension:line-col-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/statusbar-extension:kernel-status: {id: "@jupyterlab/statusbar-extension:kernel-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/statusbar-extension:running-sessions-status: {id: "@jupyterlab/statusbar-extension:running-sessions-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/statusbar-extension:memory-usage-status: {id: "@jupyterlab/statusbar-extension:memory-usage-status", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/tabmanager-extension:plugin: {id: "@jupyterlab/tabmanager-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/terminal-extension:plugin: {id: "@jupyterlab/terminal-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/theme-dark-extension:plugin: {id: "@jupyterlab/theme-dark-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/theme-light-extension:plugin: {id: "@jupyterlab/theme-light-extension:plugin", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/tooltip-extension:manager: {id: "@jupyterlab/tooltip-extension:manager", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/tooltip-extension:consoles: {id: "@jupyterlab/tooltip-extension:consoles", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/tooltip-extension:notebooks: {id: "@jupyterlab/tooltip-extension:notebooks", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/tooltip-extension:files: {id: "@jupyterlab/tooltip-extension:files", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/ui-components-extension:default-icon-registry: {id: "@jupyterlab/ui-components-extension:default-icon-registry", service: null, promise: Promise, activated: false, activate: ƒ, …}
@jupyterlab/vdom-extension:factory: {id: "@jupyterlab/vdom-extension:factory", service: null, promise: Promise, activated: false, activate: ƒ, …}
jupyter.extensions.jupyter-leaflet: {id: "jupyter.extensions.jupyter-leaflet", service: null, promise: null, activated: false, activate: ƒ, …}
matplotlib-jupyter:main: {id: "matplotlib-jupyter:main", service: null, promise: null, activated: false, activate: ƒ, …}
@jupyter-widgets/jupyterlab-manager:plugin: {id: "@jupyter-widgets/jupyterlab-manager:plugin", service: null, promise: null, activated: false, activate:

The below confirms jupyter.extensions.jupyterWidgetRegistry is provided by jupyterlab-manager.

image

metasim commented 4 years ago

I can't see why order should matter, as the registration and initialization phases are distinct. The puzzling thing is that from inspecting the stack variables, it's not clear why the lookup is failing.

The exception is thrown in Application.resolveRequiredService:

Application.prototype.resolveRequiredService = function (token) {
    // Reject the promise if there is no provider for the type.
    var id = this._serviceMap.get(token);
    if (!id) {
        return Promise.reject(new Error("No provider for: " + token.name + "."));
    }
    // Resolve immediately if the plugin is already activated.
    var data = this._pluginMap[id];
    if (data.activated) {
        return Promise.resolve(data.service);
    }
    // Otherwise, activate the plugin and wait on the results.
    return this.activatePlugin(id).then(function () { return data.service; });
};

I'm not a native JavaScript speaker, so perhaps this makes sense to others (i.e. get uses identity and not logical equality for lookup), but it feels odd.

metasim commented 4 years ago

I think I had a breakthrough... the Token types are coming from two different libraries. I'm using Jupyter 1.2.6, which uses the @phosphor library, and ipyleaflet seems to be assuming we're running in Jupyter 2.0, under the new

jupyterlab-manager token:

![image](https://user-images.githubusercontent.com/131013/78573846-2e8f6b80-77f7-11ea-927b-d8b74ad79abd.png)

jupyter-leaflet token:

![image](https://user-images.githubusercontent.com/131013/78573977-5aaaec80-77f7-11ea-9749-ae644f7eb9cc.png)
martinRenou commented 4 years ago

Woaw. Thanks a lot for all this debugging. @jasongrout are you aware of this issue?

metasim commented 4 years ago

According to this, the version of JupyterLab specifies the version of jupyterlab-manager you should use:

Not sure how the jupyter-widgets/base version maps to the jupyter-widget/jupyterlab-manager version but in 0.12.3 it was changed to "@jupyter-widgets/base": "^2 || ^3", from just "@jupyter-widgets/base": "^2.0", in 0.12.2.

Should this be considered a breaking change for JupyterLab 1.2.x users?

metasim commented 4 years ago

Confirmation: I pinned the following versions and things are now working 😅 :

metasim commented 4 years ago

@martinRenou @jasongrout Not sure if you consider this a bug or a need for compatibility documentation? I suspect this will be one of a huge number of plugins that break from JupyterLab 1.2.x -> 2.x. I'd suggest releasing 0.12.4 that works with 1.2.x, and then release 0.13.0 with the migration to JL 2.x.

metasim commented 4 years ago

@martinRenou Any chance the changes in the 0.12.x lineage could be release in a form compatible with JupyterLab 1.2.x? We just can't upgrade to JL 2.x due to other plugins not being there yet.

martinRenou commented 4 years ago

0.12.x should work with JupyterLab 1.2.x.

Actually I tried that combination yesterday and it was working just fine. Are you not seing it work? Also another question, are you by any change using ipyvolume as well?

metasim commented 4 years ago

@martinRenou No, I'm not using ipyvolume.

Last time I was trying this out was when 0.12.3 was the latest. I see you're now up to 0.12.6, so I'll give that a spin.

metasim commented 4 years ago

@martinRenou I just rebuilt with 0.12.6 and I'm back to the Error displaying widget: model not found message in the Jupyter output cell. In the browser console the error is Uncaught (in promise) Error: Module jupyter-leaflet, semver range ^0.12.6 is not registered as a widget module

Here's the current set of plugins. Has anyone else reported anything similar? Or am I a snowflake ❄️ here? 😄

jupyter labextension list
$ jupyter labextension list
        @jupyter-widgets/jupyterlab-manager v1.1.0  enabled  OK
        @jupyter-widgets/jupyterlab-sidecar v0.4.0  enabled  OK
        @jupyterlab/geojson-extension v1.0.0  enabled  OK
        @jupyterlab/git v0.9.0  enabled  OK
        @jupyterlab/shortcutui v0.4.0  enabled  OK
        jupyter-leaflet v0.12.6  enabled  OK
        nbdime-jupyterlab v1.0.0  enabled  OK