-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: do not consider webagg and nbagg "interactive" for fallback #15512
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: do not consider webagg and nbagg "interactive" for fallback #15512
Conversation
73c0df7
to
58b8743
Compare
force pushed to fix syntax. |
env's don't work the same in windows? |
b797f29
to
70ad7f7
Compare
There is logic in pyplot to determine if the user has is some way selected a backend which is incompatible with the interactive framework that we detect is running. This helps prevent issues where the user is already using one GUI frame work (ex tk) before Matplotlib is imported and has Matplotlib configured to use Qt. The other place this behavior is desired is if Matplotlib is configured to use a GUI framework by default, but is then imported on a headless server. By detecting there is no DISPLAY we fall back to Agg rather than failing to import. From the point of view of having UI events, webagg and nbagg are interactive backends, however from the point of view of requiring DISPLAY they are not. This is the minimal fix, filtering out these two backends in pyplot rather than changing this in rcsetup, incase anyone is relying on those lists for other purposes. closes matplotlib#14903
Co-Authored-By: Elliott Sales de Andrade <quantum.analyst@gmail.com>
70ad7f7
to
fd9f102
Compare
ret = subprocess.call( | ||
[sys.executable, "-c", test_code], |
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.
on windows these two lines work fine/return 'WebAgg' and 'nbAgg' respectively.
) | ||
ret = subprocess.call( | ||
[sys.executable, "-c", test_code], | ||
env={"MPLBACKEND": backend, "DISPLAY": ""} |
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.
this line, even just env={"MPLBACKEND": backend}
or env={"DISPLAY": ""}
triggers the windows failures
from the Python docs:
Note
If specified, env must provide any variables required for the program to execute. On Windows, in order to run a side-by-side assembly the specified env must include a valid SystemRoot.
thanks to @story645 for sorting this out
I think this stuff really needs some docs somewhere or we will forget why we made this change. |
@jklymak There is a long explanation in the commit message which we will see in the future when we check |
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.
Looks sane to me.
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
FIX: do not consider webagg and nbagg "interactive" for fallback
…"interactive" for fallback' FIX: do not consider webagg and nbagg "interactive" for fallback
…"interactive" for fallback' FIX: do not consider webagg and nbagg "interactive" for fallback
…interactive" for fallback'
…interactive" for fallback'
…v3.1.x Backport PR #15512 on branch v3.1.x
…v3.2.x Backport PR #15512 on branch v3.2.x
PR Summary
There is logic in pyplot to determine if the user has is some way
selected a backend which is incompatible with the interactive
framework that we detect is running. This helps prevent issues where
the user is already using one GUI frame work (ex tk) before Matplotlib
is imported and has Matplotlib configured to use Qt. The other place
this behavior is desired is if Matplotlib is configured to use a GUI
framework by default, but is then imported on a headless server. By
detecting there is no DISPLAY we fall back to Agg rather than failing
to import.
From the point of view of having UI events, webagg and nbagg are
interactive backends, however from the point of view of requiring
DISPLAY they are not.
This is the minimal fix, filtering out these two backends in pyplot
rather than changing this in rcsetup, incase anyone is relying on
those lists for other purposes.
closes #14903
This will backport badly due to the change in line light below this one but 🤷♀️
Will work on a test tomorrow.