Skip to content

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

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

Closed
lstngr opened this issue Mar 25, 2025 · 4 comments
Closed

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

lstngr opened this issue Mar 25, 2025 · 4 comments

Comments

@lstngr
Copy link

lstngr commented Mar 25, 2025

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.

@ianhi
Copy link
Collaborator

ianhi commented Mar 25, 2025

Hi @lstngr is this true for all ipywidgets, or just for ipympl? i.e. can you check with an ipywidgets.IntSlider()?

@lstngr
Copy link
Author

lstngr commented Mar 25, 2025

Thanks for the swift reply, the issue also occurs for ipywidgets with the same console error.

from IPython.display import display
import ipywidgets as widgets

w = widgets.IntSlider()
display(w)

I assume this means it's rather a JupyterLab issue?

@ianhi
Copy link
Collaborator

ianhi commented Mar 25, 2025

Yes, It''s either a jupyterlab or an ipywidgets issue. So not somethign that can be fixed here unfortunately. I would suggest opening an issue on the ipywidgets repo

@ianhi ianhi closed this as completed Mar 25, 2025
@lstngr
Copy link
Author

lstngr commented Mar 26, 2025

Thank you very much for your help! 🙏

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

2 participants