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

Widgets cannot be displayed when the notebook is opened with no kernel attached, even after we attach the notebook to an ipykernel. #3970

Open
Kontinuation opened this issue Jan 17, 2025 · 0 comments · May be fixed by #3971

Comments

@Kontinuation
Copy link

Description

I know that ipywidgets does not render without a kernel and it is expected behavior (see #3773). However, after I attach ipywidget to the notebook and run cells that produces widgets, the widgets still does not show up.

Reproduce

Launch the jupyter lab using the following command:

jupyter lab --LabServerApp.notebook_starts_kernel=False

The --LabServerApp.notebook_starts_kernel=False option makes new notebooks being opened in "No Kernel" state. When you run a cell, Jupyter Lab will open a dialog asking you to select a kernel. We select "ipykernel" to run the cells, but the widgets produced by the cell does not show up.

Here is a screen recording of a repro: https://drive.google.com/file/d/1EHGwKnv7ehDmMGw_AC4VAnseUprJPAcl/view?usp=sharing

Expected behavior

After attaching the notebook to ipykernel, newly produced widgets could show up.

Context

  • ipywidgets version: latest main branch (commit: 303cae4)
  • Operating System and version: macOS 15.2
  • Browser and version: Chrome Version 131.0.6778.265 (Official Build) (arm64)
Browser Output
plugin.ts:153 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'kernel')
    at getWidgetManagerOwner (plugin.ts:153:34)
    at async registerWidgetHandler (plugin.ts:175:25)
    at async plugin.ts:424:7

If using JupyterLab

  • JupyterLab version: 4.3.3
Installed Labextensions
jupyter_spark_ui v0.1.0 enabled OK (python, jupyter_spark_ui)
jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
sparkmonitor v3.0.2 enabled OK (python, sparkmonitor)
@jupyter-notebook/lab-extension v7.3.1 enabled OK
@jupyter-widgets/jupyterlab-manager v5.0.13 enabled OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant