Skip to content

Widget doesn't load if c.LabServerApp.notebook_starts_kernel = False #593

Closed
@lstngr

Description

@lstngr

Describe the issue

I am unsure if this should be reported in https://github.com/jupyterlab/jupyterlab or here.
Please feel free to let me know and close the issue should this be the case.

Widgets do not load if JupyterLab is started with the following configuration,

# cat ~/.jupyter/jupyter_lab_config.py
c = get_config()  #noqa
c.LabServerApp.notebook_starts_kernel = False

In particular, running the documentation's example,

%matplotlib ipympl
import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots()


x = np.linspace(0, 2*np.pi, 100)
y = np.sin(3*x)
ax.plot(x, y)

produces the following output (please note that the kernel disconnected because I shut it down, it otherwise remains running),

Image

and results in the following error in the console,

Image

06:59:36.073 Exception opening new comm 4 jlab_core.a4c5e1f5bac9ba5dc7f6.js:1:1401914
    _handleCommOpen http://localhost:8888/static/lab/jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1

I could reproduce the issue in Firefox 136.0.2 (on Arch Linux), Firefox ESR 128.8.0 (on OpenSUSE Leap 15.6), Chromium 134.0.6998.117 (on OpenSUSE Leap 15.6).

If the jupyterlab configuration is modified such that c.LabServerApp.notebook_starts_kernel = True, the widgets display correctly.

Versions

# python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter labextension list

 3.13.2 | packaged by conda-forge | (main, Feb 17 2025, 14:10:22) [GCC 13.3.0]
ipympl version: 0.9.7
Selected Jupyter core packages...
IPython          : 8.34.0
ipykernel        : 6.29.5
ipywidgets       : 8.1.5
jupyter_client   : 8.6.3
jupyter_core     : 5.7.2
jupyter_server   : 2.15.0
jupyterlab       : 4.3.6
nbclient         : 0.10.2
nbconvert        : 7.16.6
nbformat         : 5.10.4
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.14.3
JupyterLab v4.3.6
/home/me/miniconda3/envs/phys206/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        jupyter-matplotlib v0.11.7 enabled OK
        @jupyter-widgets/jupyterlab-manager v5.0.13 enabled OK (python, jupyterlab_widgets)

which has been installed from conda with: conda install -c conda-forge jupyterlab ipympl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions