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

jupyterlab-widgets-1.1.3 breaks custom widget #3741

Closed
abhumbla opened this issue Mar 25, 2023 · 2 comments
Closed

jupyterlab-widgets-1.1.3 breaks custom widget #3741

abhumbla opened this issue Mar 25, 2023 · 2 comments

Comments

@abhumbla
Copy link

Description

We have a custom widget (https://pypi.org/project/unfolded.map-sdk/) that works on jupyterlabwidget-1.1.2 and earlier, but after 1.1.3 was released, our CI tests started failing. Recreating the environment and running manually, I get the error Error serializing widget state attribute: map

Longer traceback

272.c29d26f2cf8a9ca7cd8f.js:1 Uncaught (in promise) DOMException: Failed to execute 'structuredClone' on 'Window': function(i){return typeof i=="function"?i(t,r):n(i)} could not be cloned.
    at t.serialize (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.c29d26f2cf8a9ca7cd8f.js:1:24495)
    at t.sync (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.c29d26f2cf8a9ca7cd8f.js:1:23695)
    at o.save (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/803.0c2b58ce45d740d7f0ea.js:1:6810)
    at t.save_changes (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.c29d26f2cf8a9ca7cd8f.js:1:25173)
    at o.<anonymous> (http://localhost:8888/lab/extensions/@unfolded/jupyter-map-sdk/static/480.d9e38698db357136a973.js?v=d9e38698db357136a973:1:10834)
    at Generator.next (<anonymous>)
    at r (http://localhost:8888/lab/extensions/@unfolded/jupyter-map-sdk/static/480.d9e38698db357136a973.js?v=d9e38698db357136a973:1:10179)

Reproduce

  1. pip install unfolded.map_sdk, jupyterlab-widgets==1.1.3
  2. Start a notebook
from unfolded.map_sdk import create_map
map = create_map()
display(map)
  1. The map will not load, and the console will show the above error

Expected behavior

In 1.1.2 and earlier, an embedded interactive javascript map appears as expected.

Context

This happens on a variety of systems (local machine and Github CI)

Troubleshoot Output
$PATH:
	/Users/****/.pyenv/versions/map-sdk-test/bin
	/opt/homebrew/Cellar/pyenv/2.3.6/libexec
	/opt/homebrew/Cellar/pyenv/2.3.6/plugins/python-build/bin
	/Users/****/.docker/bin
	/Users/****/google-cloud-sdk/bin
	/Users/****/local/bin
	/opt/homebrew/opt/qt@5/bin
	/Users/****/.local/bin
	/Users/****/.volta/bin
	/Users/****/.poetry/bin
	/opt/homebrew/Cellar/pyenv-virtualenv/1.1.5/shims
	/Users/****/.pyenv/shims
	/Users/****/.pyenv/bin
	/opt/homebrew/bin
	/opt/homebrew/sbin
	/usr/local/bin
	/System/Cryptexes/App/usr/bin
	/usr/bin
	/bin
	/usr/sbin
	/sbin

sys.path:
/Users//.pyenv/versions/3.8.10/envs/map-sdk-test/bin
/Users/
/.pyenv/versions/3.8.10/lib/python38.zip
/Users//.pyenv/versions/3.8.10/lib/python3.8
/Users/
/.pyenv/versions/3.8.10/lib/python3.8/lib-dynload
/Users/****/.pyenv/versions/3.8.10/envs/map-sdk-test/lib/python3.8/site-packages

sys.executable:
/Users/****/.pyenv/versions/3.8.10/envs/map-sdk-test/bin/python

sys.version:
3.8.10 (default, May 5 2022, 10:55:58)
[Clang 13.0.0 (clang-1300.0.27.3)]

platform.platform():
macOS-13.1-arm64-arm-64bit

which -a jupyter:
/Users//.pyenv/versions/map-sdk-test/bin/jupyter
/Users/
/.pyenv/shims/jupyter

pip list:
Package Version
------------------------ -----------
anyio 3.6.2
appnope 0.1.3
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
arrow 1.2.3
asttokens 2.0.8
attrs 22.1.0
Babel 2.10.3
backcall 0.2.0
beautifulsoup4 4.11.1
bleach 5.0.1
bump2version 1.0.1
bumpversion 0.6.0
certifi 2022.6.15
cffi 1.15.1
cfgv 3.3.1
charset-normalizer 2.1.0
click 8.1.3
click-plugins 1.1.1
cligj 0.7.2
debugpy 1.6.3
decorator 5.1.1
defusedxml 0.7.1
distlib 0.3.6
entrypoints 0.4
exceptiongroup 1.0.4
executing 0.10.0
fastjsonschema 2.16.1
filelock 3.8.0
Fiona 1.8.21
fqdn 1.5.1
geojson-pydantic 0.4.3
geopandas 0.10.2
identify 2.5.18
idna 3.3
importlib-metadata 4.12.0
importlib-resources 5.9.0
iniconfig 1.1.1
ipykernel 6.15.1
ipython 8.4.0
ipython-genutils 0.2.0
ipywidgets 7.7.1
isoduration 20.11.0
isort 5.12.0
jedi 0.18.1
Jinja2 3.1.2
json5 0.9.9
jsonpointer 2.3
jsonschema 4.10.2
jupyter_client 7.4.8
jupyter_core 5.1.0
jupyter-events 0.5.0
jupyter_server 2.0.4
jupyter_server_terminals 0.4.3
jupyter-ui-poll 0.2.1
jupyterlab 3.4.5
jupyterlab-pygments 0.2.2
jupyterlab-server 2.15.0
jupyterlab-widgets 1.1.3
lxml 4.9.1
MarkupSafe 2.1.1
matplotlib-inline 0.1.5
mistune 0.8.4
munch 2.5.0
mypy 0.961
mypy-extensions 0.4.3
nbclassic 0.4.3
nbclient 0.6.6
nbconvert 6.5.3
nbformat 5.4.0
nest-asyncio 1.5.5
nodeenv 1.7.0
notebook 6.4.12
notebook-shim 0.1.0
numpy 1.23.2
packaging 21.3
pandas 1.4.3
pandocfilters 1.5.0
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
pip 22.1.2
pkgutil_resolve_name 1.3.10
platformdirs 2.5.2
pluggy 1.0.0
pre-commit 3.0.4
prometheus-client 0.14.1
prompt-toolkit 3.0.30
psutil 5.9.1
ptyprocess 0.7.0
pure-eval 0.2.2
py 1.11.0
pycparser 2.21
pydantic 1.9.2
Pygments 2.13.0
pyparsing 3.0.9
pyproj 3.3.1
pyrsistent 0.18.1
pytest 7.2.0
pytest-anyio 0.0.0
pytest-mock 3.10.0
pytest-snapshot 0.9.0
python-dateutil 2.8.2
python-json-logger 2.0.4
pytz 2022.2.1
PyYAML 6.0
pyzmq 24.0.1
requests 2.28.1
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
Send2Trash 1.8.0
setuptools 63.2.0
Shapely 1.8.4
sidecar 0.5.1
six 1.16.0
sniffio 1.2.0
soupsieve 2.3.2.post1
stack-data 0.4.0
terminado 0.15.0
tinycss2 1.1.1
tomli 2.0.1
tornado 6.2
traitlets 5.8.0
typing_extensions 4.3.0
unfolded.map-sdk 1.6.0
uri-template 1.2.0
urllib3 1.26.11
virtualenv 20.16.6
wcwidth 0.2.5
webcolors 1.12
webencodings 0.5.1
websocket-client 1.3.3
wheel 0.37.1
widgetsnbextension 3.6.1
zipp 3.8.1

Command Line Output
no output out of the ordinary
Browser Output
Error serializing widget state attribute:  map

Uncaught (in promise) DOMException: Failed to execute 'structuredClone' on 'Window': function(i){return typeof i=="function"?i(t,r):n(i)} could not be cloned.
at t.serialize (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.c29d26f2cf8a9ca7cd8f.js:1:24495)
at t.sync (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.c29d26f2cf8a9ca7cd8f.js:1:23695)
at o.save (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/803.0c2b58ce45d740d7f0ea.js:1:6810)
at t.save_changes (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/272.c29d26f2cf8a9ca7cd8f.js:1:25173)
at o. (http://localhost:8888/lab/extensions/@unfolded/jupyter-map-sdk/static/480.d9e38698db357136a973.js?v=d9e38698db357136a973:1:10834)
at Generator.next ()
at r (http://localhost:8888/lab/extensions/@unfolded/jupyter-map-sdk/static/480.d9e38698db357136a973.js?v=d9e38698db357136a973:1:10179)

If using JupyterLab

  • JupyterLab version: 3.6.5
Installed Labextensions
jupyter labextension list
JupyterLab v3.4.5
/Users/***/.pyenv/versions/3.8.10/envs/map-sdk-test/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        @unfolded/jupyter-map-sdk v1.6.0 enabled OK (python, unfolded.map_sdk)
        @jupyter-widgets/jupyterlab-sidecar v0.6.1 enabled OK (python, sidecar)
        @jupyter-widgets/jupyterlab-manager v3.1.3 enabled OK (python, jupyterlab_widgets).
@jasongrout
Copy link
Member

@maartenbreddels - perhaps we should catch any failure of the structuredClone and fall back to the old JSON stringify algorithm?

@martinRenou
Copy link
Member

This is a duplicate of #3735 and should be fixed by the serialization fallback in #3738

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

3 participants