ipytree is a Python library that provides an interactive Tree Widget for Jupyter environments, built using the Jupyter-widgets protocol and jsTree. It offers an easy-to-use interface to visualize and manipulate hierarchical data structures directly within Jupyter Notebooks and JupyterLab, and can be seamlessly integrated with other `ipywidgets` components.
pip install ipytreeVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to create a basic hierarchical tree structure using `ipytree.Tree` and `ipytree.Node` objects, and then display it in a Jupyter environment. Nodes can be added and nested to form complex structures.
Upgrade `ipywidgets` to 8.0.6 or newer, which includes a fix for the `structuredClone` issue. Alternatively, downgrade `ipywidgets` to 8.0.4 or earlier.
For JupyterLab <=2, run `jupyter labextension install @jupyter-widgets/jupyterlab-manager ipytree`. For Jupyter Notebook <=5.2, run `jupyter nbextension enable --py --sys-prefix ipytree`. Modern JupyterLab 3+ and `ipywidgets >= 7.6.0` generally handle this automatically.
Ensure your JupyterLab/Notebook environment is up-to-date and that `ipywidgets` and `ipytree` are installed correctly. In some cases, a `jupyter lab build` might be necessary if manual extension management was performed, though typically `pip install` or `conda install` should suffice for modern setups. Consult the specific environment's documentation for widget compatibility.
For JupyterLab 3+ and `ipywidgets >= 7.6.0`, reinstall `ipytree` to trigger automatic extension registration. For older environments, manually install/enable the extensions as described in the warnings. Ensure Python kernel is restarted.
Update `ipywidgets` to version 8.0.6 or newer, or downgrade it to 8.0.4 or earlier.