[Bug] Jupyter plugin failing to activate with ipywidgets>=8
Description
When trying to use Deck.show(), I get the following error:
Failed to create view for 'ErrorWidgetView' from module '@jupyter-widgets/base' with model 'JupyterTransportModel' from module '@deck.gl/jupyter-widget'
TypeError: Cannot read properties of undefined (reading 'length')
at H.updateTooltip (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/595.e3c9c115ecf5763f080b.js?v=e3c9c115ecf5763f080b:1:15660)
at H.initialize (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/595.e3c9c115ecf5763f080b.js?v=e3c9c115ecf5763f080b:1:14751)
at new e.View (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/644.11f638668109f1562dd1.js?v=11f638668109f1562dd1:1:14134)
at new C (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/595.e3c9c115ecf5763f080b.js?v=e3c9c115ecf5763f080b:1:12342)
at new H (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/595.e3c9c115ecf5763f080b.js?v=e3c9c115ecf5763f080b:1:22807)
at http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:2804
at async w.renderModel (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:72264)
I've installed pydeck in a fresh conda environment with only jupyter. I've run the steps to enable pydeck within Jupyter Notebook and Jupyter Lab. I've tried both the classic notebook and lab and it happens on both.
Flavors
- [ ] React
- [X] Python/Jupyter notebook
- [ ] MapboxLayer
- [ ] GoogleMapsOverlay
- [ ] CartoLayer
- [ ] DeckLayer/DeckRenderer for ArcGIS
Expected Behavior
I expect an interactive map to render.
Steps to Reproduce
Create new conda environment
conda create -n pydeck pydeck jupyterlab
Enable pydeck in Jupyter Lab
jupyter labextension install @jupyter-widgets/jupyterlab-manager
DECKGL_SEMVER=`python -c "import pydeck; print(pydeck.frontend_semver.DECKGL_SEMVER)"`
jupyter labextension install @deck.gl/jupyter-widget@$DECKGL_SEMVER
Start Jupyter Lab
jupyter lab
In a new notebook, try running sample code
import pydeck as pdk
UK_ACCIDENTS_DATA = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv'
layer = pdk.Layer(
'HexagonLayer', # `type` positional argument is here
UK_ACCIDENTS_DATA,
get_position=['lng', 'lat'],
auto_highlight=True,
elevation_scale=50,
pickable=True,
elevation_range=[0, 3000],
extruded=True,
coverage=1)
# Set the viewport location
view_state = pdk.ViewState(
longitude=-1.415,
latitude=52.2323,
zoom=6,
min_zoom=5,
max_zoom=15,
pitch=40.5,
bearing=-27.36)
# Combined all of it and render a viewport
r = pdk.Deck(layers=[layer], initial_view_state=view_state)
r.show()
Environment
- Framework version: [email protected]
- Browser: Chrome Version 111.0.5563.65 (Official Build) (64-bit)
- OS: Windows 10, running conda and jupyter through WSL with Ubuntu 22.04.1 LTS
- Conda environment:
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
aiofiles 22.1.0 pyhd8ed1ab_0 conda-forge
aiosqlite 0.18.0 pyhd8ed1ab_0 conda-forge
anyio 3.6.2 pyhd8ed1ab_0 conda-forge
argon2-cffi 21.3.0 pyhd8ed1ab_0 conda-forge
argon2-cffi-bindings 21.2.0 py311hd4cff14_3 conda-forge
asttokens 2.2.1 pyhd8ed1ab_0 conda-forge
attrs 22.2.0 pyh71513ae_0 conda-forge
babel 2.12.1 pyhd8ed1ab_1 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 pyhd8ed1ab_3 conda-forge
backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge
beautifulsoup4 4.11.2 pyha770c72_0 conda-forge
bleach 6.0.0 pyhd8ed1ab_0 conda-forge
brotlipy 0.7.0 py311hd4cff14_1005 conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2022.12.7 ha878542_0 conda-forge
certifi 2022.12.7 pyhd8ed1ab_0 conda-forge
cffi 1.15.1 py311h409f033_3 conda-forge
charset-normalizer 2.1.1 pyhd8ed1ab_0 conda-forge
comm 0.1.2 pyhd8ed1ab_0 conda-forge
cryptography 39.0.2 py311h9b4c7bb_0 conda-forge
debugpy 1.6.6 py311hcafe171_0 conda-forge
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
entrypoints 0.4 pyhd8ed1ab_0 conda-forge
executing 1.2.0 pyhd8ed1ab_0 conda-forge
flit-core 3.8.0 pyhd8ed1ab_0 conda-forge
idna 3.4 pyhd8ed1ab_0 conda-forge
importlib-metadata 6.0.0 pyha770c72_0 conda-forge
importlib_metadata 6.0.0 hd8ed1ab_0 conda-forge
importlib_resources 5.12.0 pyhd8ed1ab_0 conda-forge
ipykernel 6.21.3 pyh210e3f2_0 conda-forge
ipython 8.11.0 pyh41d4057_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
ipywidgets 8.0.4 pyhd8ed1ab_0 conda-forge
jedi 0.18.2 pyhd8ed1ab_0 conda-forge
jinja2 3.1.2 pyhd8ed1ab_1 conda-forge
json5 0.9.5 pyh9f0ad1d_0 conda-forge
jsonschema 4.17.3 pyhd8ed1ab_0 conda-forge
jupyter_client 8.0.3 pyhd8ed1ab_0 conda-forge
jupyter_core 5.2.0 py311h38be061_0 conda-forge
jupyter_events 0.6.3 pyhd8ed1ab_0 conda-forge
jupyter_server 2.4.0 pyhd8ed1ab_0 conda-forge
jupyter_server_fileid 0.8.0 pyhd8ed1ab_0 conda-forge
jupyter_server_terminals 0.4.4 pyhd8ed1ab_1 conda-forge
jupyter_server_ydoc 0.6.1 pyhd8ed1ab_0 conda-forge
jupyter_ydoc 0.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab 3.6.1 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab_server 2.20.0 pyhd8ed1ab_0 conda-forge
jupyterlab_widgets 3.0.5 pyhd8ed1ab_0 conda-forge
ld_impl_linux-64 2.40 h41732ed_0 conda-forge
libblas 3.9.0 16_linux64_openblas conda-forge
libcblas 3.9.0 16_linux64_openblas conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 12.2.0 h65d4601_19 conda-forge
libgfortran-ng 12.2.0 h69a702a_19 conda-forge
libgfortran5 12.2.0 h337968e_19 conda-forge
libgomp 12.2.0 h65d4601_19 conda-forge
liblapack 3.9.0 16_linux64_openblas conda-forge
libnsl 2.0.0 h7f98852_0 conda-forge
libopenblas 0.3.21 pthreads_h78a6416_3 conda-forge
libsodium 1.0.18 h36c2ea0_1 conda-forge
libsqlite 3.40.0 h753d276_0 conda-forge
libstdcxx-ng 12.2.0 h46fd767_19 conda-forge
libuuid 2.32.1 h7f98852_1000 conda-forge
libzlib 1.2.13 h166bdaf_4 conda-forge
markupsafe 2.1.2 py311h2582759_0 conda-forge
matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge
mistune 2.0.5 pyhd8ed1ab_0 conda-forge
nbclassic 0.5.3 pyhb4ecaf3_3 conda-forge
nbclient 0.7.2 pyhd8ed1ab_0 conda-forge
nbconvert 7.2.9 pyhd8ed1ab_0 conda-forge
nbconvert-core 7.2.9 pyhd8ed1ab_0 conda-forge
nbconvert-pandoc 7.2.9 pyhd8ed1ab_0 conda-forge
nbformat 5.7.3 pyhd8ed1ab_0 conda-forge
ncurses 6.3 h27087fc_1 conda-forge
nest-asyncio 1.5.6 pyhd8ed1ab_0 conda-forge
notebook 6.5.3 pyha770c72_0 conda-forge
notebook-shim 0.2.2 pyhd8ed1ab_0 conda-forge
numpy 1.24.2 py311h8e6699e_0 conda-forge
openssl 3.0.8 h0b41bf4_0 conda-forge
packaging 23.0 pyhd8ed1ab_0 conda-forge
pandoc 2.19.2 h32600fe_2 conda-forge
pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge
parso 0.8.3 pyhd8ed1ab_0 conda-forge
pexpect 4.8.0 pyh1a96a4e_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pip 23.0.1 pyhd8ed1ab_0 conda-forge
pkgutil-resolve-name 1.3.10 pyhd8ed1ab_0 conda-forge
platformdirs 3.1.0 pyhd8ed1ab_0 conda-forge
prometheus_client 0.16.0 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.38 pyha770c72_0 conda-forge
prompt_toolkit 3.0.38 hd8ed1ab_0 conda-forge
psutil 5.9.4 py311hd4cff14_0 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge
pycparser 2.21 pyhd8ed1ab_0 conda-forge
pydeck 0.8.0 pyhd8ed1ab_0 conda-forge
pygments 2.14.0 pyhd8ed1ab_0 conda-forge
pyopenssl 23.0.0 pyhd8ed1ab_0 conda-forge
pyrsistent 0.19.3 py311h2582759_0 conda-forge
pysocks 1.7.1 pyha2e5f31_6 conda-forge
python 3.11.0 he550d4f_1_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-fastjsonschema 2.16.3 pyhd8ed1ab_0 conda-forge
python-json-logger 2.0.7 pyhd8ed1ab_0 conda-forge
python_abi 3.11 3_cp311 conda-forge
pytz 2022.7.1 pyhd8ed1ab_0 conda-forge
pyyaml 6.0 py311hd4cff14_5 conda-forge
pyzmq 25.0.0 py311hd6ccaeb_0 conda-forge
readline 8.1.2 h0f457ee_0 conda-forge
requests 2.28.2 pyhd8ed1ab_0 conda-forge
rfc3339-validator 0.1.4 pyhd8ed1ab_0 conda-forge
rfc3986-validator 0.1.1 pyh9f0ad1d_0 conda-forge
send2trash 1.8.0 pyhd8ed1ab_0 conda-forge
setuptools 67.5.1 pyhd8ed1ab_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
sniffio 1.3.0 pyhd8ed1ab_0 conda-forge
soupsieve 2.3.2.post1 pyhd8ed1ab_0 conda-forge
stack_data 0.6.2 pyhd8ed1ab_0 conda-forge
terminado 0.17.1 pyh41d4057_0 conda-forge
tinycss2 1.2.1 pyhd8ed1ab_0 conda-forge
tk 8.6.12 h27826a3_0 conda-forge
tomli 2.0.1 pyhd8ed1ab_0 conda-forge
tornado 6.2 py311hd4cff14_1 conda-forge
traitlets 5.9.0 pyhd8ed1ab_0 conda-forge
typing-extensions 4.4.0 hd8ed1ab_0 conda-forge
typing_extensions 4.4.0 pyha770c72_0 conda-forge
tzdata 2022g h191b570_0 conda-forge
urllib3 1.26.14 pyhd8ed1ab_0 conda-forge
wcwidth 0.2.6 pyhd8ed1ab_0 conda-forge
webencodings 0.5.1 py_1 conda-forge
websocket-client 1.5.1 pyhd8ed1ab_0 conda-forge
wheel 0.38.4 pyhd8ed1ab_0 conda-forge
widgetsnbextension 4.0.5 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
y-py 0.5.9 py311hfe55011_0 conda-forge
yaml 0.2.5 h7f98852_2 conda-forge
ypy-websocket 0.8.2 pyhd8ed1ab_0 conda-forge
zeromq 4.3.4 h9c3ff4c_1 conda-forge
zipp 3.15.0 pyhd8ed1ab_0 conda-forge
Logs
Browser console logs
Plugin '@deck.gl/jupyter-widget:plugin' failed to activate.
(anonymous) @ index.es6.js:2288
index.es6.js:2289 Error: No provider for: jupyter.extensions.jupyterWidgetRegistry.
at W.<anonymous> (index.es6.js:2191:66)
at l (index.es6.js:52:23)
at Object.next (index.es6.js:33:53)
at index.es6.js:26:71
at new Promise (<anonymous>)
at c (index.es6.js:22:12)
at e.resolveRequiredService (index.es6.js:2184:16)
at index.es6.js:2081:76
at Array.map (<anonymous>)
at W.<anonymous> (index.es6.js:2081:44)
(anonymous) @ index.es6.js:2289
11150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1 Error: No version of module @deck.gl/jupyter-widget is registered
at f.loadClass (134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:74856)
at f.loadModelClass (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:10729)
at f._make_model (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:7517)
at f.new_model (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:5137)
at 150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:6385
at Array.map (<anonymous>)
at f._loadFromKernel (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:6278)
at async f.restoreWidgets (134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:77764)
loadModelClass @ 150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1
150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1 Could not create a view for model id 35b2c3f8a2f849ca97a0e3fa37d597a0
(anonymous) @ 150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1
3134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1 Error: widget model not found
at f.get_model (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3461)
at w.renderModel (134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:72019)
renderModel @ 134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1
After some additional investigation, this seems to be caused by an issue with ipywidgets>=8, since if I roll back to ipywidgets=7.7.3, I am able to load pydeck in jupyter.
@jeffliu-LL can be this ticket solved updating documentation and dependencies of pydeck or do you consider the limitation to use ipywidgets>=8 as a blocker?
Thanks for checking in. The limitation is that pydeck currently only works with ipywidgets 7; I would like to see eventual support for ipywidgets>=8.
Hi, I can confirm the bug as well.
Is there a plan for Pydeck to support ipywidgets 8? Ipywidgets 8 introduced breaking changes from version 7. (The cause of why pydeck stops working).
Currently, my codebase is written against ipywidget 8, so just downgrading to ipywidget 7 is not working.. 🙁
For those coming from Google.. there is a workaround. Use to_html() and pipe it to output widgets, rather than show() and pydeck should work regardless of ipywidgets version. Of course you lose the jupyterbinding and callback possibility, which is not ideal.