Jupyter Notebook Widgets Frontend Extension

raw JSON →
4.0.15 verified Tue May 12 auth: no python install: stale quickstart: stale

widgetsnbextension is a Python package that provides the essential JavaScript frontend components, enabling Jupyter interactive widgets (ipywidgets) to function within the classic Jupyter Notebook environment. It acts as a bridge, allowing Python widget objects in the kernel to be rendered and interact with the user interface. The library, currently at version 4.0.15 (released November 1, 2025), is an integral part of the broader Jupyter Widgets ecosystem, maintaining an active release cadence alongside ipywidgets and Jupyter itself.

pip install widgetsnbextension
gotcha Widgets may not render, showing a text representation (e.g., `IntSlider(value=0)`) instead of the interactive component. This typically indicates that the JavaScript frontend extension is either not properly installed or enabled for your Jupyter environment.
fix Ensure `widgetsnbextension` is installed and enabled for classic Jupyter Notebook (`jupyter nbextension enable --py widgetsnbextension --sys-prefix`). For JupyterLab, install `@jupyter-widgets/jupyterlab-manager` (`jupyter labextension install @jupyter-widgets/jupyterlab-manager`). Restart your Jupyter server after installation/enabling.
breaking The `jupyter nbextension enable` command might be deprecated or not found in newer Jupyter installations, especially with JupyterLab 3.0+ or Notebook 7+.
fix For JupyterLab 3.0+, `ipywidgets` version 7.6.0 and later automatically enable support without manual `jupyter labextension install` if installed with pip/conda. If issues persist, refer to the `ipywidgets` documentation for the latest installation steps specific to your Jupyter version.
gotcha Version mismatches between `ipywidgets` and `widgetsnbextension` can lead to unexpected behavior or failure to render widgets.
fix Always install `ipywidgets` and `widgetsnbextension` (and `jupyterlab_widgets` for JupyterLab) from the same source (e.g., all from PyPI, or all from conda-forge) and ideally upgrade them together to compatible versions. Pip's dependency resolution usually handles this, but manual intervention might be needed for complex environments.
gotcha Intermittent failures to render saved widget states, leading to 'Error displaying widget: model not found' when reopening a notebook.
fix This can sometimes be related to underlying server or file system issues, especially in shared environments. Ensure your Jupyter server environment is stable and check for any disk-related errors if the problem persists across multiple notebooks. Saving widget state automatically might exacerbate issues with unstable storage.
gotcha Custom Jupyter extensions or server configurations can sometimes conflict with `ipywidgets`' communication channels, preventing widgets from functioning correctly.
fix If you are developing or using other Jupyter extensions, test `ipywidgets` in a clean environment first. Review your custom extension's interaction with kernel communication, specifically `Comm` channels, as conflicts can arise if multiple extensions attempt to manage them simultaneously.
breaking `ipywidgets` module not found, leading to `ModuleNotFoundError`. This indicates that the `ipywidgets` package is not installed in the Python environment where the script is being executed.
fix Install `ipywidgets` using pip (`pip install ipywidgets`) or conda (`conda install -c conda-forge ipywidgets`). Ensure the installation is performed in the correct Python environment associated with your Jupyter server or script execution.
breaking The `ipywidgets` Python package is not installed, leading to a `ModuleNotFoundError` when attempting to import it.
fix Install the `ipywidgets` package using pip (`pip install ipywidgets`) or conda (`conda install -c conda-forge ipywidgets`). Ensure your Python environment is correctly activated before installation.
conda install widgetsnbextension
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - - 22.2M
3.10 alpine (musl) - - - -
3.10 slim (glibc) wheel 1.6s - 23M
3.10 slim (glibc) - - - -
3.11 alpine (musl) wheel - - 24.0M
3.11 alpine (musl) - - - -
3.11 slim (glibc) wheel 1.7s - 24M
3.11 slim (glibc) - - - -
3.12 alpine (musl) wheel - - 15.9M
3.12 alpine (musl) - - - -
3.12 slim (glibc) wheel 1.6s - 16M
3.12 slim (glibc) - - - -
3.13 alpine (musl) wheel - - 15.6M
3.13 alpine (musl) - - - -
3.13 slim (glibc) wheel 1.6s - 16M
3.13 slim (glibc) - - - -
3.9 alpine (musl) wheel - - 21.7M
3.9 alpine (musl) - - - -
3.9 slim (glibc) wheel 1.9s - 22M
3.9 slim (glibc) - - - -

This quickstart demonstrates how to create and display a simple interactive integer slider using `ipywidgets`. While `widgetsnbextension` is the underlying component enabling this in the classic Notebook, the user-facing interaction is primarily through the `ipywidgets` library. The `display` function is used to render the widget, and an observer is attached to react to value changes.

from ipywidgets import IntSlider, display
import time

slider = IntSlider(value=0, min=0, max=10, step=1, description='Value:')
display(slider)

def on_value_change(change):
    print(f"Slider value changed to: {change.new}")

slider.observe(on_value_change, names='value')