keplergl / kepler.gl

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
http://kepler.gl
MIT License
10.26k stars 1.72k forks source link

[Bug][Jupyter Widget] Error displaying widget: model not found (still) #1165

Open khof312 opened 4 years ago

khof312 commented 4 years ago

Description I have been struggling with the problem described in this issue and this one for a few days now. I've tried the instructions but they don't seem to fix the problem. I can't reopen the issue so I have created a new one here.

To Reproduce When I type:

from keplergl import KeplerGl
map_1 = KeplerGl()
map_1

I get:

User Guide: https://docs.kepler.gl/docs/keplergl-jupyter
Error displaying widget: model not found

Developer console error:

manager.js:319 Uncaught (in promise) Error: Module keplergl-jupyter, semver range ^0.2.0 is not registered as a widget module
    at WidgetManager.loadClass (manager.js:319)
    at WidgetManager.<anonymous> (manager-base.js:264)
    at step (manager-base.js:45)
    at Object.next (manager-base.js:26)
    at manager-base.js:20
    at new Promise (<anonymous>)
    at push.SEna.__awaiter (manager-base.js:16)
    at WidgetManager.push.SEna.ManagerBase._make_model (manager-base.js:258)
    at WidgetManager.<anonymous> (manager-base.js:247)
    at step (manager-base.js:45)

Expected behavior I expect to see a slippy map.

Environment (please complete the following information):

jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : 4.7.5
ipython          : 7.15.0
ipykernel        : 5.3.0
jupyter client   : 6.1.3
jupyter lab      : 2.1.4
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.6
traitlets        : 4.3.3

jupyter labextension list

JupyterLab v2.1.4
Known labextensions:
   app dir: C:\Users\[USER]\.conda\envs\py36\share\jupyter\lab
        @jupyter-widgets/jupyterlab-manager v2.0.0 enabled  ok
        @jupyterlab/toc v3.0.0 enabled  ok
        js v0.1.0 enabled  ok
        jupyter-gmaps v0.9.0 enabled  ok
        jupyter-leaflet v0.13.0 enabled  ok
        jupyterlab-jupytext v1.2.1 enabled  ok
        jupyterlab-stata-highlight v0.1.1 enabled  ok
        keplergl-jupyter v0.2.0 enabled  ok

Additional context The problem seems to affect any extensions with a slippy map, including gmaps and ipyleaflet. I believe it arose when I downloaded and started to use kepler (probably from updating some packages in the process?) since gmaps used to work. To be clear, it's fine in Jupyter notebook, just not in lab.

Any thoughts would be much appreciated!

imaginefish commented 4 years ago

I also got the same bug report with jupyter lab, but jupyter notebook works.

Here are my jupyter version:

jupyter core : 4.6.3 jupyter-notebook : 6.1.1 qtconsole : 4.7.5 ipython : 7.16.1 ipykernel : 5.3.4 jupyter client : 6.1.6 jupyter lab : 2.1.5 nbconvert : 5.6.1 ipywidgets : 7.5.1 nbformat : 5.0.7 traitlets : 4.3.3

All jupyter lab extensions are installed and enabled:

JupyterLab v2.1.5 Known labextensions: app dir: /opt/anaconda3/share/jupyter/lab @jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK keplergl-jupyter v0.2.0 enabled OK

I guess there are still some bugs when using jupyter lab in current version of keplergl(0.2.0), hope someone can fix it.

kuanb commented 3 years ago

Same issue here:

vendors~main.accab467ede46e07a003.js:2 Uncaught (in promise) Error: Module keplergl-jupyter, semver range ^0.2.0 is not registered as a widget module
    at C.loadClass (vendors~main.accab467ede46e07a003.js:2)
    at C.<anonymous> (vendors~main.accab467ede46e07a003.js:2)
    at l (vendors~main.accab467ede46e07a003.js:2)
    at Object.next (vendors~main.accab467ede46e07a003.js:2)
    at vendors~main.accab467ede46e07a003.js:2
    at new Promise (<anonymous>)
    at Rtm6.S (vendors~main.accab467ede46e07a003.js:2)
    at C.e._make_model (vendors~main.accab467ede46e07a003.js:2)
    at C.<anonymous> (vendors~main.accab467ede46e07a003.js:2)
    at l (vendors~main.accab467ede46e07a003.js:2)

Got "this far" by following instructions outlined on this post.

ramayer commented 3 years ago

The best workaround I found so far is to wrap it in an iframe like this:

import keplergl
import base64

map1      = keplergl.KeplerGl()
orig_html = str(map1._repr_html_(),'utf-8')
b64d_html = base64.b64encode(orig_html.encode('utf-8')).decode('utf-8')
framed_html = f'<iframe src="data:text/html;base64,{b64d_html}" style="width:95%; height: 600px">'
import IPython
IPython.display.HTML(framed_html)
adaaaaaa commented 3 years ago

in jupyterlab I get an empty map...@ramayer jupyter --version jupyter core : 4.7.1 jupyter-notebook : 6.4.0 qtconsole : not installed ipython : 7.25.0 ipykernel : 6.0.1 jupyter client : 6.2.0 jupyter lab : 3.0.16 nbconvert : 6.0.7 ipywidgets : 7.6.3 nbformat : 5.1.3 traitlets : 5.0.5

adaaaaaa commented 3 years ago

from keplergl import KeplerGl map_1 = KeplerGl() map_1

get the same error

User Guide: https://docs.kepler.gl/docs/keplergl-jupyter
Error displaying widget: model not found