-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix IPython import issue #19597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IPython import issue #19597
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Well, I just learned something about the expected behavior of |
This suggests we should make a similar change in |
Thanks @philnagel! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again. |
…597-on-v3.4.x Backport PR #19597 on branch v3.4.x (Fix IPython import issue)
When blocking import of
IPython
by definingsys.modules["IPython"] = None
, creating plots fails becausebackend_bases.FigureCanvasBase._fix_ipython_backend2gui
attempts to check ifIPython
is already imported by looking for an entry insys.modules
. It then attempts to importIPython
, which fails due to the import being blocked.Code sample to reproduce the issue:
which results in:
This PR addresses this issue by not only checking if
IPython
is present insys.modules
, but also if it is blocked from being imported.