Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

don't set a default backend, fixes #6 #7

Merged
merged 2 commits into from
Jul 1, 2020

Conversation

ngoldbaum
Copy link
Contributor

If you install the matplotlib wheel on a non-framework build of python, setting macosx as the default backend causes in ImportError (see #6). Since we can't tell whether or not we're installing into a framework build ahead of time, I think it's safer to set TkAgg as the default backend on macs.

@ngoldbaum ngoldbaum changed the title don't set macosx as the default backend on macs don't set macosx as the default backend on macs. fixes #6 Nov 12, 2018
@anntzer
Copy link

anntzer commented Nov 12, 2018

Or just set no default at all and let matplotlib handle the fallback?

@ngoldbaum ngoldbaum changed the title don't set macosx as the default backend on macs. fixes #6 don't set a default backend, fixes #6 Nov 12, 2018
@ngoldbaum
Copy link
Contributor Author

fair enough, see the last push

@anntzer
Copy link

anntzer commented Nov 12, 2018

don't actually have a mac to test, but looks about right

@ngoldbaum
Copy link
Contributor Author

Looks like the build failures are happening because wheel changed its API, I think we worked around that in other feedstocks by pinning wheel.

@matthew-brett any chance you can weigh in about this PR? It would be nice to have matplotlib wheels that don't crash when you import pyplot :)

@matthew-brett
Copy link
Contributor

As a Mac user, it makes me nervous. The TkAgg backend is far inferior in appearance, so it means a shift from default fairly pretty to default ugly.

Some people do use virtualenvs, but they tend to be more advanced users who can work out what to do.

The Python venv module solves the problem.

I guess all current Mac installers include Tk? (Python.org, homebrew, macports)

@tacaswell
Copy link
Contributor

the osx backend is the first one tried (see https://github.com/matplotlib/matplotlib/blob/63fe909eaefe4f4c9639177f67792af6984f7267/lib/matplotlib/pyplot.py#L193-L195 ) so if it is available and works it get picked.

@matthew-brett
Copy link
Contributor

Ah - sorry - that's what you get if you ask a lazy person for an opinion :). Yes, that seems reasonable. The downside would be that someone using virtualenvs may be confused as to why their plots went ugly inside the virtualenv. Are y'all warning them about the non-framework builds before backing off to TkAgg?

@ngoldbaum
Copy link
Contributor Author

Here's what happens in a non-framework build of python when I have matplotlib 3.0.2 installed from source instead of the pip wheel on pypi:

In [1]: from matplotlib import pyplot

In [2]: pyplot.get_backend()
Out[2]: 'Qt5Agg'

After uninstalling pyqt5, here's what happens:

In [1]: from matplotlib import pyplot

In [2]: pyplot.get_backend()
Out[2]: 'TkAgg'

So no warning, but this is an improvement over crashing, and I guess an improvement over what happened with matplotlib before 3.0 in that now people get a functioning TK backend instead of a subtly broken MacOSX backend on a non-framework python build.

@tacaswell
Copy link
Contributor

what do we have to do to the naming to safely replace the wheels?

I think this behavior is a reasonable change.

@tacaswell
Copy link
Contributor

In 39cf18e and 73a9f41 we stopped setting the backend. I'm going to merge this to clean up the now un-used bash variables.

@tacaswell tacaswell merged commit af9b709 into MacPython:master Jul 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants