[Fix] Pin ipython<9.16 to unbreak the docs build - #709
Conversation
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.
|
CI has now closed the one gap I flagged as not verified in the description. I said there that I had only run notebook execution locally, not a full The remaining red on this PR is unrelated to the change. The I want to be careful about one thing I could easily have claimed and cannot. My other open PRs do show |
|
Worth flagging that this PR is what unblocks the other four open ones.
All four failures are the same Separately, a re-run on #708 today cleared its |
|
Update that should make these cheap to clear. The data host looks recovered, so a re-run is likely all these five need now. The red jobs on this PR are from 05 August and every failure in them is the corpus fetch, not the branch: Since then the same fetch has started working. Your own I cannot trigger a re-run myself. If you re-run the failed jobs on this one and on #706, #707, #708 and #710, I would expect all five to go green without any push from me. The docs picture is unchanged from my earlier note, this branch is still the only one carrying the |
|
Correcting my note above. A re-run happened on #706 this morning and it did not clear everything, so "a re-run is likely all these five need" was wrong. Attempt 2 on Two separate things are left, and neither is the branch.
I ran
That is notebook execution meeting a newer IPython that dropped |
|
Update on the data host, since I said earlier that a rerun would not help and that is no longer true. All three red jobs here are This morning the host served GitHub runners again. NeuralEnsemble/python-neo#1894 ran at 08:39 UTC and pulled So a rerun here is now worth a click. I cannot trigger one myself, One thing worth not chasing. The warning in these logs is expected and harmless. |
The docs build currently fails on every branch, including master.
What breaks
make htmldies while nbsphinx executesdoc/tutorials/spade.ipynb, on the first cell atimport viziphant:Why
requirements-docs.txtasks forjupyter>=1.0.0, which pulls IPython unpinned. Installing the current docs requirements on Python 3.12 resolves toipython 9.16.1andmatplotlib 3.8.4.IPython 9.16 removed the public
backend2guialias fromIPython.core.pylabtools. matplotlib below 3.9 imports that alias inpyplot.install_repl_displayhook(), which runs whenever pyplot is used inside a live IPython shell.import viziphantreaches it via holoviews callingplt.switch_backend("agg"). The resolved environment therefore cannot work.Why pin IPython rather than raise matplotlib
Raising matplotlib does not fix it. viziphant 0.4.0, the latest release from November 2023 and a
requirements-tutorials.txtdependency, callsmatplotlib.cm.get_cmap, which matplotlib removed in 3.9. With matplotlib 3.11.1 the same notebook gets past the import and then fails atviziphant.patterns.plot_patternswithAttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'.So the
matplotlib<3.9cap is load bearing, andipython<9.16restores the last working combination. The pin goes inrequirements-docs.txtbecause that is the only requirements file that brings in a Jupyter or IPython runtime. I confirmed empirically that a tutorials only install pulls neither.This also records why the matplotlib cap exists. It was added in #634 without a note, which makes it easy to remove by mistake. The commit is
6ce65584, titled "[Fix] Tests for Neo 0.13.1, add same object to list", so the requirements change was incidental to that PR's stated purpose.The durable fix is a viziphant release that stops using
cm.get_cmap. Both pins can come off then, andenvironment-docs.ymlcould drop itspython=3.12, whose stated reason is this same cap.Verified on Python 3.12, matching the docs CI job:
spade.ipynbfails with the error above on its first cell.spade.ipynbexecutes cleanly at 6 of 6 cells with no error outputs.statistics.ipynb,unitary_event_analysis.ipynbandgranger_causality.ipynbalso pass.cm.get_cmappresent in matplotlib 3.8.4 and absent in 3.9.0, andbackend2guipresent in IPython 9.15.0 and absent in 9.16.1.ipython<9.16appears in the built wheel'sdocsextra, so CI'spip install -e .[extras,tutorials,docs]picks it up.Not verified
make html, only notebook execution.gpfa.ipynbandasset.ipynbdid not finish in my local environment andparallel.ipynbneeds mpi4py, so I make no claim about those three.Disclosure: this change was prepared with AI assistance. I have reviewed and tested it.