Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Try/except import of Axes3D#27178
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
On some installs, the `mpl_toolkits` namespace package gets an oldversion which uses deprecated (And removed) code from the main library.On such the import of Axes3D will error with an `ImportError`.This prevents users from using any of `matplotlib`, since it is importedunconditionally by default.This just try/excepts the imports (and adjusts the registration codeaccordingly) to allow users to continue using matplotlib (though not 3Dand possibly not other mpl_toolkits) even with older installs occludingthe mpl_toolkits.
Do we want to add a warning somewhere in here? (Currently just silently ignores that the import didn't work) I'm 50/50 on it currently: There issomething wrong with the install, butmost users are unlikely to be negatively affected by it, and getting a warning unrelated to what you are doing seems unhelpful. Perhaps wecould put code in the retrieval that looks for the |
I think we should warn. I'm inclined to let people know that their installations are messed up (or I may just be cranky today after two h5py issues that boiled down to "broken installation"). |
I did not use |
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
…178-on-v3.8.xBackport PR#27178 on branch v3.8.x (Try/except import of Axes3D)
Needed for the same reasons asmatplotlib#27178 (Namely that we should not be failing on import just because mpl_toolkits is broken), but mpl 3.6 presents with an AttributeError rather than ImportErrorSee discussion inmatplotlib#26827 andmatplotlib#27289Just expanded liberally in case there are other presentations we have not seen
Needed for the same reasons asmatplotlib#27178 (Namely that we should not be failing on import just because mpl_toolkits is broken), but mpl 3.6 presents with an AttributeError rather than ImportErrorSee discussion inmatplotlib#26827 andmatplotlib#27289Just expanded liberally in case there are other presentations we have not seen
PR summary
On some installs, the
mpl_toolkits
namespace package gets an oldversion which uses deprecated (And removed) code from the main library.
On such the import of Axes3D will error with an
ImportError
.This prevents users from using any of
matplotlib
, since it is importedunconditionally by default.
This just try/excepts the imports (and adjusts the registration code
accordingly) to allow users to continue using matplotlib (though not 3D
and possibly not other mpl_toolkits) even with older installs occluding
the mpl_toolkits.
Addresses at least the most pressing part of#26827
(Not quite sure we want to close that or not)
PR checklist