Repository navigation
Limit version of IPython to < 9.17.0 to avoid import error during notebook validation - #1118
Merged
Merged
Conversation
Kera's `plot_model` function has a check for whether graphviz is installed. If it is not installed, `plot_model` does one of two things depending on whether "IPython.core.magics.namespace" is present in `sys.modules`: if it is present, `plot_model` prints a message; if it is not present, it raises an `ImportError`. Unfortunately, starting in IPython 9.17.0:(upstream commit 7f0ee55684f0, "Declare IPython's built-in magics lazily"), IPython no longer eagerly imports `IPython.core.magics.*` modules (including "IPython.core.magics.namespace") at kernel startup. The script `ci_validate_tutorials.sh` does pip-installs ipython, but it set a lower version limit, not an upper version limit. So now when the script runs, it installs IPython >= 9.17.0 and we get `ImportError` during notebook validation. The simplest solution is to set the upper bound on the version, which is what this PR does.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the ipython dependency constraint in scripts/ci_validate_tutorials.sh to avoid breaking versions. The reviewer pointed out a typo in the version constraint (<9.17.0 instead of <8.17.0), which would allow the installation of the breaking 8.17.0 version, and suggested correcting it to <8.17.0.
MichaelBroughton
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some of the notebooks use Kera's
plot_modelfunction. That function has a check for whether graphviz is installed. If it is not installed,plot_modelthen tests whether "IPython.core.magics.namespace" is present insys.modulesand does one of two things: if it's present,plot_modelprints a message; if it is not present, it raises anImportError. Unfortunately, starting in IPython 9.17.0, IPython no longer eagerly importsIPython.core.magics.*modules at startup. Unless Graphviz is installed separately in the run-time environment, callingplot_modelwill raise anImportError.Our notebook checks are done using our script
ci_validate_tutorials.sh, and that script pip-installs IPython, but it only sets a lower bound on the version number. As a result, when the script executes in CI, it installs a version of IPython >= 9.17.0, which leadsplot_modelto fail the test for "IPython.core.magics.namespace", which leads it to raiseImportErrorin CI.The simplest solution is to add an upper bound on the version number in
ci_validate_tutorials.sh, which is what this PR does. This will solve the CI failures and also help any users who may encounter the same problem when testing notebooks locally.