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

ipywidgets.interact only updates once inside JupyterLite 0.4.0 #3935

Open
lagru opened this issue Aug 20, 2024 · 2 comments
Open

ipywidgets.interact only updates once inside JupyterLite 0.4.0 #3935

lagru opened this issue Aug 20, 2024 · 2 comments

Comments

@lagru
Copy link

lagru commented Aug 20, 2024

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

  1. Go to https://jupyter.org/try-jupyter/lab/
  2. Verify that JupyterLite is version 0.4.0 under Menu bar > Help > About
  3. 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);
  1. Move slider once -> output updates
  2. 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
@jtpio
Copy link
Member

jtpio commented Sep 17, 2024

Thanks @lagru for the report 👍

This looks similar to this issue opened on the JupyterLite repo: jupyterlite/jupyterlite#1465

Do you know if this was already an issue with JupyterLite 0.3.0?

@bdcodebase
Copy link

No, in JupiterLite 0.3.0 it works.

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