[Python] ipywidgets not displaying in JupyterLab & Jupyter Notebook: 'Error displaying widget'

Discussão em 'Python' iniciado por Stack, Fevereiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to use ipywidgets in JupyterLab, but I'm getting the error: Error displaying widget

    Here's a minimal example that reproduces the issue:

    import ipywidgets as widgets
    from IPython.display import display
    slider = widgets.IntSlider(min=0, max=100)
    display(slider)


    What I've checked so far:

    1. jupyter --version:

    IPython : 8.30.0
    ipykernel : 6.29.5
    ipywidgets : 7.7.2
    jupyter_client : 8.6.3
    jupyter_core : 5.7.2
    jupyter_server : 2.14.1
    jupyterlab : 4.3.4
    nbclient : 0.8.0
    nbconvert : 7.16.4
    nbformat : 5.10.4
    notebook : 7.3.2
    qtconsole : 5.6.1
    traitlets : 5.14.3


    1. jupyter labextension list :

    JupyterLab v4.3.4
    JupyterLab v4.3.4
    /home/username/.conda/envs/test_venv/share/jupyter/labextensions
    jupyterlab-plotly v5.24.1 enabled X
    @lckr/jupyterlab_variableinspector v3.1.0 enabled OK (python, lckr_jupyterlab_variableinspector)
    @pyviz/jupyterlab_pyviz v3.0.2 enabled OK
    @jupyter-notebook/lab-extension v7.3.2 enabled OK
    @jupyter-widgets/jupyterlab-manager v3.0.0 enabled X (python, jupyterlab_widgets)


    The following extensions may be outdated or specify dependencies that are incompatible with the current version of jupyterlab:
    jupyterlab-plotly
    @jupyter-widgets/jupyterlab-manager

    If you are a user, check if an update is available for these packages.
    If you are a developer, re-run with `--verbose` flag for more details.

    Other labextensions (built into JupyterLab)
    app dir: /home/username/.conda/envs/test_venv/share/jupyter/lab
    @jupyterlab/plotly-extension v1.0.0 enabled X

    The following extensions may be outdated or specify dependencies that are incompatible with the current version of jupyterlab:
    @jupyterlab/plotly-extension

    If you are a user, check if an update is available for these packages.
    If you are a developer, re-run with `--verbose` flag for more details.


    How can I fix this issue and get ipywidgets to display properly in JupyterLab and Jupyter Notebook? Do I need to reinstall or update specific extensions?

    Continue reading...

Compartilhe esta Página