ipydatawidgets
ipydatawidgets is a Python library that provides a set of interactive HTML widgets for Jupyter notebooks, designed to facilitate the reuse and efficient transmission of large datasets. Its primary purpose is to offer a standardized way to move array data between the Python kernel and the frontend, enabling multiple widgets to share the same data with a single network synchronization. The current version is 4.3.5, with an infrequent release cadence, the last PyPI release being in June 2023.
Common errors
-
Error displaying widget
cause This common error typically indicates that the Jupyter frontend (Notebook or Lab) cannot load or render the widget's JavaScript component. This is often due to missing or incompatible `ipywidgets` extensions, or conflicting Python/JavaScript widget versions.fixEnsure `ipywidgets` is correctly installed and compatible with your Jupyter environment. For JupyterLab, try `pip install jupyterlab_widgets` and potentially `jupyter labextension disable @jupyter-widgets/jupyterlab-manager && jupyter labextension enable @jupyter-widgets/jupyterlab-manager`. For classic Notebook, ensure `widgetsnbextension` is enabled. Check your `ipywidgets` version against `ipydatawidgets` requirements. -
ImportError: DLL load failed: The specified procedure could not be found.
cause This error, often seen on Windows within Anaconda environments, typically points to conflicts between different Python installations or environment issues affecting underlying libraries like `tornado` or `ssl` that `notebook` (and thus `ipywidgets`) depends on.fixVerify that you are using a consistent Python environment (e.g., solely Anaconda's Python). Sometimes, reinstalling `ipywidgets`, `notebook`, or even your Anaconda environment can resolve deep-seated DLL conflicts. `conda update --all` or creating a fresh environment is often recommended. -
Model class 'JupyterComm...' not found in registry (or similar 'Model class ... not found')
cause This specific error often arises when there's an incompatibility between the versions of `ipywidgets` (especially v8) and `jupyterlab-widgets` (especially v3) or when a custom widget's frontend model isn't properly registered or is incompatible with the manager.fixEnsure `ipywidgets` and `jupyterlab_widgets` (or `widgetsnbextension` for classic Notebook) are compatible. For `ipydatawidgets`, stick to `ipywidgets <9`. If you are developing a custom widget, verify your `_model_name`, `_view_name`, `_model_module`, `_view_module`, and their respective `_module_version` traits are correctly defined and match the expected `ipywidgets` API.
Warnings
- gotcha When using JupyterLab 1 or 2, you may need to manually install the JupyterLab extension. Modern JupyterLab 3.x+ usually auto-configures `ipywidgets` support.
- breaking ipydatawidgets requires `ipywidgets` version >=7.6.0 and <9. Using `ipywidgets` v9 or higher may lead to compatibility issues or 'Error displaying widget' messages, as underlying APIs might have changed.
- gotcha For developers creating custom widget libraries that integrate `ipydatawidgets`, be aware of breaking changes in `ipywidgets` itself (e.g., between v6, v7, and v8). These often involve updates to `_view_module_version`, `_model_module_version`, and `webpack` configurations.
Install
-
pip install ipydatawidgets
Imports
- NDArrayWidget
from ipydatawidgets import NDArrayWidget
- DataUnion
from ipydatawidgets import DataUnion
Quickstart
import numpy as np from ipydatawidgets import NDArrayWidget # Create some raw NumPy data raw_data = np.random.rand(10, 10, 3).astype(np.float32) # Wrap the raw data in an NDArrayWidget data_widget = NDArrayWidget(raw_data) # The data_widget can now be passed to other widgets that accept NDArrayWidget instances # For demonstration, we'll just display it (though NDArrayWidget itself doesn't have a complex visual representation out of the box) data_widget