From 296bba2be145abc439167a19152bf10dcbd67cca Mon Sep 17 00:00:00 2001 From: Aditya Singh Date: Wed, 5 Aug 2026 10:26:04 -0700 Subject: [PATCH] [Fix] Pin ipython<9.16 to unbreak the docs build The docs job fails on every branch, including master, while nbsphinx executes doc/tutorials/spade.ipynb: ImportError: cannot import name 'backend2gui' from 'IPython.core.pylabtools' requirements-docs.txt asks for jupyter>=1.0.0, which pulls IPython unpinned and now resolves to 9.16.1. IPython 9.16 removed the public backend2gui alias from IPython.core.pylabtools. matplotlib<3.9 imports that alias in pyplot.install_repl_displayhook(), which runs whenever pyplot is used inside a live IPython shell, so the docs environment resolves to a combination that cannot work. The matplotlib<3.9 cap has to stay. viziphant 0.4.0, the latest release and a requirements-tutorials.txt dependency, calls matplotlib.cm.get_cmap, which matplotlib removed in 3.9. Raising matplotlib only trades the ImportError for an AttributeError in the same notebook. Pinning IPython below 9.16 restores the last working combination. The pin lives in requirements-docs.txt because that is the only requirements file that brings in a Jupyter or IPython runtime. Also records why the matplotlib cap exists, since it was added without a note and is easy to remove by mistake. --- requirements/requirements-docs.txt | 6 ++++++ requirements/requirements-tutorials.txt | 2 ++ 2 files changed, 8 insertions(+) diff --git a/requirements/requirements-docs.txt b/requirements/requirements-docs.txt index 036071f44..4bad079e2 100644 --- a/requirements/requirements-docs.txt +++ b/requirements/requirements-docs.txt @@ -1,10 +1,16 @@ # Packages required to build docs (in addition to requirements-tutorials.rst) numpydoc>=1.1.0 jupyter>=1.0.0 +# IPython 9.16 removed the public `backend2gui` alias from IPython.core.pylabtools. +# matplotlib<3.9 imports that alias in pyplot.install_repl_displayhook(), so the two +# cannot be installed together. Lift this pin once the matplotlib cap below is lifted. +ipython<9.16 sphinx>=3.3.0 nbsphinx>=0.8.0 sphinxcontrib-bibtex>1.0.0 sphinx-tabs>=1.3.0 +# Capped at <3.9 because viziphant 0.4.0 (latest release, 2023-11) calls +# matplotlib.cm.get_cmap, which matplotlib removed in 3.9. matplotlib>=3.3.2, <3.9.0 docutils<0.22 # conda install -c conda-forge pandoc diff --git a/requirements/requirements-tutorials.txt b/requirements/requirements-tutorials.txt index e7b3f4e92..279ab37c2 100644 --- a/requirements/requirements-tutorials.txt +++ b/requirements/requirements-tutorials.txt @@ -1,4 +1,6 @@ # Packages required to execute jupyter notebook tutorials +# Capped at <3.9 because viziphant 0.4.0 (latest release, 2023-11) calls +# matplotlib.cm.get_cmap, which matplotlib removed in 3.9. matplotlib>=3.3.2, <3.9.0 h5py>=3.1.0 nixio>=1.5.0