Describe the bug
Attempting to display a map in JupyterLab 2.1.0 prints an error within Jupyter Lab: "Error displaying widget: model not found"
My guess (but I really am guessing!) is that the keplergl widget needs to be updated to play nicely with JupyterLab 2.1.0. (Or maybe I'm doing something stupid! This is the first time I've tried installing the keplergl widget!)
To Reproduce
Installation:
conda config --add channels conda-forge
conda create --name test_kepler python=3.8 jupyterlab ipywidgets nodejs
conda activate test_kepler
pip install keplergl
jupyter labextension install @jupyter-widgets/jupyterlab-manager keplergl-jupyter
jupyter lab
Create a new notebook and run:
from keplergl import KeplerGl
map_1 = KeplerGl()
map_1
Output:
User Guide: https://github.com/keplergl/kepler.gl/blob/master/docs/keplergl-jupyter/user-guide.md
Error displaying widget: model not found
Expected behavior
A map should be displayed :)
Environment:
jupyter labextension list
JupyterLab v2.1.0
Known labextensions:
app dir: /home/jack/miniconda3/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
jupyterlab-plotly v4.6.0 enabled OK
keplergl-jupyter v0.1.2 enabled OK
Bug reports in other projects
Here are issues in other projects where users report seeing the "Error displaying widget: model not found" issue:
A work-around in kepler's Jupyter widget:
from keplergl import KeplerGl
map_1 = KeplerGl()
map_1.save_to_html()
And then open keplergl_map.html in a browser. (And it looks gorgeous!)
BTW, pydeck also suffers from the same problem: Running deck.show() in a Jupyter Lab cell returns Error displaying widget: model not found. A work-around in pydeck is to run deck.to_html() and load the html in a browser.
@JackKelly your work-around does not take advantage of Kepler.gl feature to render the interactive widget inside the notebook, allowing to edit it, and then save the notebook (taking care of having "Settings -> Save Widget State Automatically") to save the state of the Kepler-gl widget: then use e.g. "map_1.config" to get the saved config from it, that could be saved as a file (that could be used as an input config when creating the widget itself, so to allow easy editing of the kepler.gl map, and as a last action do a "save_to_html" to create the final file).
Anyway, trying (but not succeeding) to solve your same problem (that is also reported by others, and is an outstanding problem) I can report this:
Besides your installation steps, I've also done these actions:
jupyter nbextension install --py --sys-prefix keplergl
jupyter nbextension enable --py --sys-prefix keplergl
...and then in JupyterLab:
Settings -> Enable Extension Manager (experimental)
I'm not sure which action triggered a different behaviour than the "Error displaying widget: model not found", but now when trying to display the widget with:
map_1 = KeplerGl()
map_1
...I get this instead:
User Guide: https://github.com/keplergl/kepler.gl/blob/master/docs/keplergl-jupyter/user-guide.md
Loading widget...
...but actually the widget never shows up. The kernel works (filled circle) and then it goes back to unused state (empty circle), and I can keep using the notebook normally, but instead of the interactive kepler.gl widget I just have that "Loading widget..." text.
I'm getting this as well. So far no luck with updating or any other trouble shooting.
I am getting same errors. This wasn't happening a few weeks ago, I tried with new env and still no luck.
Any updates on this? perhaps the best way is to downgrade Jupyterlab? Can anyone let me know the last jupyterlab version that this worked with?
Upgrade widget to kepler.gl@^2 and supporting JupyterLab 2
https://github.com/keplergl/kepler.gl/pull/1110
just published keplergl==0.2.0 with support for JupyterLab 2.0
I am now able to get this working in jupyter lab 2.1.2!! Hooray! Thanks @heshan0131
For future reference here are my versions:
jupyter --version
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.3
ipython : 7.14.0
ipykernel : 5.2.1
jupyter client : 6.1.3
jupyter lab : 2.1.2
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.6
traitlets : 4.3.3
Node version:
node v10.20.1
No success here.
Here's what I've done:
jupyter labextension update @jupyter-widgets/jupyterlab-manager keplergl-jupyter
After this command, the automatic build of JupyterLab started and failed, so I've done:
export NODE_OPTIONS=--max-old-space-size=4096
jupyter lab build
...and the build completed successfully.
Then in JupyterLab I've tried with:
from keplergl import KeplerGl
map_1 = KeplerGl()
map_1
...but I've got the same behavior as before (the "Loading widget..." message, without actually showing the widget).
These are my versions:
jupyter --version
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.1
ipython : 7.13.0
ipykernel : 5.1.4
jupyter client : 6.0.0
jupyter lab : 2.0.1
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.4
traitlets : 4.3.3
You can try my instructions here: https://github.com/firasm/keplergl_tutorial/blob/master/1%20-%20Install/Installation%20instructions.ipynb.
You may need to also run
jupyter labextension install keplergl-jupyter
and
jupyter labextension enable keplergl-jupyter
P.S. I'd also encourage you to update jupyter to 2.1.2 (pip install jupyter --upgrade) just in case something changed on their side
Thank you for your kind help @firasm
Though, I haven't solved the problem.
I've done the following:
jupyter labextension install keplergl-jupyter
jupyter labextension enable keplergl-jupyter
conda update -c conda-forge jupyterlab
export NODE_OPTIONS=--max-old-space-size=4096
jupyter lab build
So now I have:
jupyter --version
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.4
ipython : 7.14.0
ipykernel : 5.2.1
jupyter client : 6.1.3
jupyter lab : 2.1.2
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.6
traitlets : 4.3.3
Oh, maybe this is useful to highlight: I see from Chrome developer console this problem when I open a .ipynb file that uses Kepler.gl:
_manager-base.js:274_
Could not instantiate widget
_manager.js:319_
Uncaught (in promise) Error: Module keplergl-jupyter, semver range ^0.1.0 is not registered as a widget module
Ah, it seems your keplergl widget version is old. You鈥檒l need the latest one that was released yesterday:
pip install keplergl 鈥攗pgrade
Thanks @firasm, I thought I had upgraded to the latest one relased yesterday, but probably I did it in a wrong way... because well, after a pip install keplergl --upgrade, now it is working, the keplergl map is shown into JupyterLab.
Though, in Chrome developer console, I still get that error:
_manager-base.js:274_
Could not instantiate widget
_manager.js:319_
Uncaught (in promise) Error: Module keplergl-jupyter, semver range ^0.1.0 is not registered as a widget module
I'm curious if I'm the only one now with a working keplergl widget in JupyterLab 2, who gets that error in console, or it's a normal thing.
Regardless of that, anyway, big thanks to @heshan0131 and whoever else contributed to making this work in JupyterLab 2, and thank you @firasm for your guide towards making it work for me.
--Note-- I realized that I can't reopen this issue, so I have moved my comment into a new one below:
Received the same error, and after countless tries to update jupyterlab + keplergl I found myself in the following situation:
JupyterLab v2.2.0
Known labextensions:
app dir: /opt/conda/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
@jupyterlab/git v0.21.1 enabled OK
@jupyterlab/google-drive v2.0.0 enabled OK
@jupyterlab/toc v4.0.0 enabled OK
jupyterlab-plotly v4.10.0 enabled OK
keplergl-jupyter v0.2.1 enabled OK
nbdime-jupyterlab v2.0.0 enabled OK
plotlywidget v4.10.0 enabled OK
Uninstalled core extensions:
keplergl-jupyter
Namely the extension was both unknown and installed, which seems to be bit of a jupyterlab bug (https://discourse.jupyter.org/t/extension-shows-up-as-both-installed-and-uninstalled-and-doesnt-work/2688/5)
Solution as suggested was to delete the build_config.json file at ../jupyter/lab/settings/build_config.json
(Sidenote: Now I finally keplergl working on my AI Notebook at google cloud platform, hurray!)
Thanks for an awesome product!
Most helpful comment
just published
keplergl==0.2.0with support for JupyterLab 2.0