Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
QuLogic merged 3 commits intomatplotlib:mainfromksunden:3d_missing
Oct 26, 2023
Merged

Conversation

ksunden
Copy link
Member

PR summary

On some installs, thempl_toolkits namespace package gets an old
version which uses deprecated (And removed) code from the main library.

On such the import of Axes3D will error with anImportError.
This prevents users from using any ofmatplotlib, since it is imported
unconditionally 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

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.
@ksunden
Copy link
MemberAuthor

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"3d" key and gives a targeted error message rather than just a standardKeyError, such that we tell users what is going on, but only those affected by it? (not sure I like that complexity though...)

@tacaswelltacaswell added this to thev3.8.1 milestoneOct 23, 2023
@tacaswell
Copy link
Member

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").

anntzer and timhoffm reacted with thumbs up emoji

@ksunden
Copy link
MemberAuthor

I did not useImportWarning, which, while it seems appropriate, is ignored by default and therefore wouldn't actually warn most users.

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@QuLogicQuLogic merged commit652d44a intomatplotlib:mainOct 26, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestOct 26, 2023
timhoffm added a commit that referenced this pull requestOct 26, 2023
…178-on-v3.8.xBackport PR#27178 on branch v3.8.x (Try/except import of Axes3D)
ksunden added a commit to ksunden/matplotlib that referenced this pull requestNov 8, 2023
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
ksunden added a commit to ksunden/matplotlib that referenced this pull requestNov 8, 2023
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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@QuLogicQuLogicQuLogic approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.8.1
Development

Successfully merging this pull request may close these issues.

3 participants
@ksunden@tacaswell@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp