ipywidgets
ipywidgets copied to clipboard
ipywidgets.interact only updates once inside JupyterLite 0.4.0
Description
It seems that there's an incompatibility between ipywidgets and JupyterLite 0.4.0. When I post the simple snippet below into an empty notebook cell and run it, the slider appears as expected. If I move the slider once the output changes as expected. If I move it again, the output doesn't update anymore.
I didn't find an existing issue on this, apologies if missed one.
Reproduce
- Go to https://jupyter.org/try-jupyter/lab/
- Verify that JupyterLite is version 0.4.0 under Menu bar > Help > About
- Paste the following snippet into the cell of a notebook
%pip install -q ipywidgets
import ipywidgets
print(f"{ipywidgets.__version__=}")
def f(x):
return x
ipywidgets.interact(f, x=10);
- Move slider once -> output updates
- Move slider again -> output isn't updated anymore
Expected behavior
The output keeps updating, if the slider is moved multiple times.
Context
I noticed this issue while trying to get scikit-image's tutorials to run in JupyterLite. Initially I thought that using ipywidgets in JupyterLite was not yet possible but then discovered that you include a demo in your docs. I was surprised that it seemed to work fine in your demo and quickly discovered that you are using JupyterLite 0.3.0.
Current plan is to use JupyterLite 0.3.0 then for the tutorial.
- ipywidgets version: 8.1.3
- Operating System and version: Arch Linux 6.10.5-arch1-1 (64-bit)
- Browser and version: Firefox 129.0.1 (64-bit)
Browser Output
Pyodide contents will be synced with Jupyter Contents [index.js:60:28](webpack://jupyterlite/pyodide-kernel-extension/lib/index.js) Starting WebSocket: wss://jupyter.org/try-jupyter/api/kernels/b1eb5825-59e3-4432-9206-26f19f49d4c2 [default.js:69:20](webpack://_JUPYTERLAB.CORE_OUTPUT/node_modules/@jupyterlab/services/lib/kernel/default.js) Loading micropip, packaging [pyodide.asm.js:10:93500](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loaded micropip, packaging [pyodide.asm.js:10:93796](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm did not respond in time [327.68dbf8491690b3aff1e7.js:1:5783](https://jupyter.org/try-jupyter/extensions/@jupyter-widgets/jupyterlab-manager/static/327.68dbf8491690b3aff1e7.js?v=68dbf8491690b3aff1e7) Loading openssl, ssl [pyodide.asm.js:10:93500](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loaded openssl, ssl [pyodide.asm.js:10:93796](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loading sqlite3 [pyodide.asm.js:10:93500](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loaded sqlite3 [pyodide.asm.js:10:93796](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loading traitlets [pyodide.asm.js:10:93500](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loaded traitlets [pyodide.asm.js:10:93796](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) traitlets already loaded from default channel [pyodide.asm.js:10:93166](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) sqlite3 already loaded from default channel [pyodide.asm.js:10:93166](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loading Pygments, asttokens, decorator, executing, ipython, matplotlib-inline, prompt_toolkit, pure_eval, six, stack_data, wcwidth [pyodide.asm.js:10:93500](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js) Loaded Pygments, asttokens, decorator, executing, ipython, matplotlib-inline, prompt_toolkit, pure_eval, six, stack_data, wcwidth [pyodide.asm.js:10:93796](https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.asm.js)
Note, the Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel line appears just after opening an empty notebook.
If using JupyterLab
- JupyterLite version: 0.4.0