Jupyter Interactive Widgets (ipywidgets)
raw JSON → 8.1.8 verified Tue May 12 auth: no python install: verified quickstart: verified
ipywidgets is a Python library that provides interactive HTML widgets for Jupyter notebooks and the IPython kernel. It enables users to create interactive controls like sliders, text boxes, and buttons, bringing notebooks to life and allowing interactive exploration of data and models. The current version is 8.1.8, and it maintains an active development cycle with regular patch and minor releases, and major versions typically every few years.
pip install ipywidgets Common errors
error ModuleNotFoundError: No module named 'ipywidgets' ↓
cause The `ipywidgets` Python package is not installed in the active Python environment or the Jupyter kernel where you are trying to use it.
fix
Install
ipywidgets using pip or conda: pip install ipywidgets or conda install ipywidgets. Ensure you install it in the same environment that your Jupyter kernel is using. error Error displaying widget / widgets displaying as text (e.g., VBox(children=(Button(...)))) ↓
cause The Jupyter (Notebook/Lab) frontend extension for `ipywidgets` is either not installed, not enabled, or not correctly configured for the current environment, preventing the browser from rendering interactive controls. This can also be due to an outdated browser cache or an incompatible Jupyter version.
fix
Ensure
ipywidgets and the corresponding JupyterLab or classic Notebook extensions are installed and enabled. For JupyterLab 3.x+, use pip install jupyterlab_widgets. For older Jupyter Notebook, use jupyter nbextension enable --py --sys-prefix widgetsnbextension. After installation, restart Jupyter and perform a hard refresh of your browser page (Ctrl+Shift+R or Cmd+Shift+R). error AttributeError: module 'ipywidgets' has no attribute '...' (e.g., 'TagsInput', '_ipython_display_') ↓
cause This error often indicates an API incompatibility, typically when upgrading `ipywidgets` (e.g., from version 7 to 8), where a feature, class, or attribute has been removed or renamed. It can also occur if a specific widget is not part of the core `ipywidgets` library.
fix
Consult the
ipywidgets documentation for the correct API for your installed version and update your code accordingly. If the attribute belongs to a custom widget, ensure that specific widget's package is installed and compatible with your ipywidgets version. Restarting the Python kernel may also help. error `ipywidgets.interact` shows the widget itself but does not apply the function ↓
cause The callback function associated with `interact` is not being triggered, which can stem from conflicting Jupyter Notebook extensions, an unhealthy kernel state, or JavaScript execution issues within the browser environment.
fix
Try disabling any potentially conflicting Jupyter Notebook extensions (e.g., 'Limit Output'). Verify that the Jupyter kernel is running and healthy. Restart the kernel and rerun all cells in the notebook. A hard refresh of your browser or trying a different browser may also resolve the issue.
Warnings
breaking The `FileUpload` widget API changed significantly in version 8.x. The `.data` and `.metadata` traits were removed, and the `.value` trait was revamped to be a list of dictionaries, each containing file information (e.g., `content`, `name`, `type`, `size`, `last_modified`). ↓
fix Rewrite usage of `FileUpload` to access file content and metadata through the new `.value` structure. For example, to get content bytes: `[f.content.tobytes() for f in uploader.value]`.
breaking The `description_tooltip` attribute, used for tooltips on some widgets, was deprecated in favor of a universal `tooltip` attribute available on all widgets inheriting `DOMWidget` in version 8.x. ↓
fix Replace `description_tooltip` with `tooltip` in your widget instantiations and property assignments.
breaking The `description` field of most widgets now sanitizes HTML content by default. If you rely on custom HTML in descriptions, it will be stripped or rendered as plain text. ↓
fix Set `description_allow_html=True` explicitly for the widget if you are in full control of the HTML content and require it to be rendered.
breaking The method for setting titles on container widgets like `Accordion` or `Tab` changed. Direct calls to `container.set_title(index, title)` can cause `IndexError` if not handled correctly. It is now recommended to initialize with a `titles` tuple or assign to the `_titles` trait. ↓
fix When initializing `Accordion` or `Tab`, provide titles using the `titles` argument (e.g., `Accordion(children=[...], titles=('Title 1', 'Title 2'))`) or assign to the `_titles` trait after creation.
gotcha Direct `print()` statements within functions linked to widgets (especially with `@interact` or `widget.observe()`) may not always display reliably or may appear in the console instead of the notebook output area in newer Jupyter environments. ↓
fix Use an `ipywidgets.Output` widget as a context manager to capture and display output reliably. Wrap `print()` calls within a `with output_widget:` block and use `clear_output()` for controlled updates.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 1.45s 79.2M
3.10 alpine (musl) - - 1.40s 56.2M
3.10 slim (glibc) wheel 5.0s 1.04s 80M
3.10 slim (glibc) - - 1.02s 57M
3.11 alpine (musl) wheel - 2.12s 83.7M
3.11 alpine (musl) - - 2.20s 59.7M
3.11 slim (glibc) wheel 5.5s 1.82s 84M
3.11 slim (glibc) - - 1.69s 60M
3.12 alpine (musl) wheel - 2.09s 74.5M
3.12 alpine (musl) - - 2.04s 50.5M
3.12 slim (glibc) wheel 5.0s 2.06s 75M
3.12 slim (glibc) - - 2.13s 51M
3.13 alpine (musl) wheel - 2.10s 74.3M
3.13 alpine (musl) - - 2.13s 50.1M
3.13 slim (glibc) wheel 4.9s 2.05s 75M
3.13 slim (glibc) - - 2.00s 51M
3.9 alpine (musl) wheel - 1.53s 55.5M
3.9 alpine (musl) - - 1.36s 55.4M
3.9 slim (glibc) wheel 5.0s 1.18s 56M
3.9 slim (glibc) - - 1.13s 56M
Imports
- ipywidgets
import ipywidgets as widgets - interact
from ipywidgets import interact - display
from IPython.display import display - Button
from ipywidgets import Button - VBox
from ipywidgets import VBox - Output wrong
from ipywidgets import outcorrectfrom ipywidgets import Output
Quickstart verified last tested: 2026-04-24
import ipywidgets as widgets
from IPython.display import display, HTML, clear_output
# Create a simple IntSlider widget
slider = widgets.IntSlider(
min=0,
max=100,
step=1,
description='Value:',
value=50
)
# Create an Output widget to capture print statements
output = widgets.Output()
# Define a function to be called when the slider's value changes
def on_value_change(change):
with output:
clear_output()
print(f"Slider value changed to: {change['new']}")
# Observe changes in the slider's value
slider.observe(on_value_change, names='value')
# Display the slider and the output area
display(HTML("<h3>Interactive Slider Example</h3>"))
display(slider, output)