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

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

Merged
dopplershift merged 6 commits into matplotlib:master from tacaswell:fix_webagg_fallback
Oct 31, 2019

Conversation

Copy link
Member

@tacaswell tacaswell commented Oct 25, 2019

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.

@tacaswell tacaswell added this to the v3.1.2 milestone Oct 25, 2019
Copy link
Member Author

force pushed to fix syntax.

Copy link
Member Author

env's don't work the same in windows?

@jklymak jklymak added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Oct 29, 2019
tacaswell and others added 5 commits October 30, 2019 22:00
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>
Comment on lines 17 to 18
ret = subprocess.call(
[sys.executable, "-c", test_code],
Copy link
Member

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": ""}
Copy link
Member

@story645 story645 Oct 31, 2019
edited
Loading

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.

Copy link
Member

jklymak commented Oct 31, 2019

I think this stuff really needs some docs somewhere or we will forget why we made this change.

Copy link
Member Author

@jklymak There is a long explanation in the commit message which we will see in the future when we check git blame.

Copy link
Contributor

@dopplershift dopplershift left a 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.

@dopplershift dopplershift merged commit 126de7f into matplotlib:master Oct 31, 2019
Copy link

lumberbot-app bot commented Oct 31, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.1.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 126de7f92cf2f7cf32279bb60736ea5c115dd122
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #15512: FIX: do not consider webagg and nbagg "interactive" for fallback'
  1. Push to a named branch :
git push YOURFORK v3.1.x:auto-backport-of-pr-15512-on-v3.1.x
  1. Create a PR against branch v3.1.x, I would have named this PR:

"Backport PR #15512 on branch v3.1.x"

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.

Copy link

lumberbot-app bot commented Oct 31, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 126de7f92cf2f7cf32279bb60736ea5c115dd122
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #15512: FIX: do not consider webagg and nbagg "interactive" for fallback'
  1. Push to a named branch :
git push YOURFORK v3.2.x:auto-backport-of-pr-15512-on-v3.2.x
  1. Create a PR against branch v3.2.x, I would have named this PR:

"Backport PR #15512 on branch v3.2.x"

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.

@tacaswell tacaswell deleted the fix_webagg_fallback branch November 1, 2019 00:53
story645 pushed a commit to story645/matplotlib that referenced this pull request Nov 1, 2019
FIX: do not consider webagg and nbagg "interactive" for fallback
story645 pushed a commit to story645/matplotlib that referenced this pull request Nov 1, 2019
..."interactive" for fallback'
FIX: do not consider webagg and nbagg "interactive" for fallback
story645 pushed a commit to story645/matplotlib that referenced this pull request Nov 1, 2019
..."interactive" for fallback'
FIX: do not consider webagg and nbagg "interactive" for fallback
story645 pushed a commit to story645/matplotlib that referenced this pull request Nov 1, 2019
story645 pushed a commit to story645/matplotlib that referenced this pull request Nov 1, 2019
story645 pushed a commit to story645/matplotlib that referenced this pull request Nov 1, 2019
story645 pushed a commit to story645/matplotlib that referenced this pull request Nov 1, 2019
timhoffm added a commit that referenced this pull request Nov 1, 2019
jklymak added a commit that referenced this pull request Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@QuLogic QuLogic QuLogic left review comments

@dopplershift dopplershift dopplershift approved these changes

@story645 story645 story645 approved these changes

Assignees
No one assigned
Labels
GUI: nbagg GUI: webagg Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.1.2
Development

Successfully merging this pull request may close these issues.

'MPLBACKEND=webagg' is overwritten by agg when $DISPLAY is not set on Linux

AltStyle によって変換されたページ (->オリジナル) /