Bug 1526834
| Summary: | default backend is 'agg' but shouldn't be, started two Fedora releases ago | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Paul DeStefano <prd-fedora> |
| Component: | python-matplotlib | Assignee: | Lumír Balhar <lbalhar> |
| Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 28 | CC: | cstratak, dominik, gwync, jonathan.underwood, lbalhar, mhroncok, paulo.cesar.pereira.de.andrade, pviktori, python-sig, quantum.analyst, thibault.north, tomspur |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-05-22 09:27:58 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Paul DeStefano
2017-12-17 21:18:06 UTC
Another fedora release passes. I don't understand why this has not been fixed. Thomas is not very active in Fedora those days. Lumír, you would be my first choice for "science" Python issues. Can you please look at this? Hello. I cannot reproduce the issue. Could you please try it again with the latest version of matplotlib? I have python3-matplotlib version 2.2.2-1.fc28 which has TkAgg as a default backend. AFAIK the backend should be chosen automatically when it's available and python3-matplotlib-tk is installed as a dependency automatically so TkAgg should be used. I've tried also 'Qt5Agg' backend. First, I've installed python3-matplotlib-qt5 package which doesn't change default backend so I've had to set it manually (via an environment variable). From my point of view, everything works as expected. I've tested that on my laptop with Fedora 28 and also in a Docker container with Fedora 27. How can I reproduce your issue? Have a nice day. Interesting, it occurs on my system. $ rpm --query python3-matplotlib-tk python3-matplotlib-tk-2.2.2-1.fc28.x86_64 $ python3 Python 3.6.5 (default, Mar 29 2018, 18:20:46) [GCC 8.0.1 20180317 (Red Hat 8.0.1-0.19)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib.pyplot as plt >>> print(plt.get_backend()) agg On a VM, however, I see the expected behavior. Sorry. Do you have any idea how I can figure out what is wrong? I've checked for old python packages, and that doesn't seem to be it. I tried loading with verbose flag; here's what I see on my system: >>> import matplotlib.pyplot as plt ... import 'matplotlib.figure' # <_frozen_importlib_external.SourceFileLoader object at 0x7efc2301f2e8> # /usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/__init__.cpython-36.pyc matches /usr/lib64/python3.6/site-packages/matplotlib/backends/__init__.py # code object from '/usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/__init__.cpython-36.pyc' import 'matplotlib.backends' # <_frozen_importlib_external.SourceFileLoader object at 0x7efc2159aef0> # /usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/backend_agg.cpython-36.pyc matches /usr/lib64/python3.6/site-packages/matplotlib/backends/backend_agg.py # code object from '/usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/backend_agg.cpython-36.pyc' # extension module 'matplotlib.backends._backend_agg' loaded from '/usr/lib64/python3.6/site-packages/matplotlib/backends/_backend_agg.cpython-36m-x86_64-linux-gnu.so' # extension module 'matplotlib.backends._backend_agg' executed from '/usr/lib64/python3.6/site-packages/matplotlib/backends/_backend_agg.cpython-36m-x86_64-linux-gnu.so' import 'matplotlib.backends._backend_agg' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7efc214d5c50> import 'matplotlib.backends.backend_agg' # <_frozen_importlib_external.SourceFileLoader object at 0x7efc214e55f8> import 'matplotlib.pyplot' # <_frozen_importlib_external.SourceFileLoader object at 0x7efc555870f0> >>> It looks like MPL finds and loads 'agg' first thing. Do you know what is supposed to happen here? Here's what I see on the VM: >>> import matplotlib.pyplot as plt ... import 'matplotlib.backends' # <_frozen_importlib_external.SourceFileLoader object at 0x7fd53ed60a20> # /usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/backend_tkagg.cpython-36.pyc matches /usr/lib64/python3.6/site-packages/matplotlib/backends/backend_tkagg.py # code object from '/usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/backend_tkagg.cpython-36.pyc' # /usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/tkagg.cpython-36.pyc matches /usr/lib64/python3.6/site-packages/matplotlib/backends/tkagg.py # code object from '/usr/lib64/python3.6/site-packages/matplotlib/backends/__pycache__/tkagg.cpython-36.pyc' # /usr/lib64/python3.6/tkinter/__pycache__/__init__.cpython-36.pyc matches /usr/lib64/python3.6/tkinter/__init__.py # code object from '/usr/lib64/python3.6/tkinter/__pycache__/__init__.cpython-36.pyc' # extension module '_tkinter' loaded from '/usr/lib64/python3.6/lib-dynload/_tkinter.cpython-36m-x86_64-linux-gnu.so' # extension module '_tkinter' executed from '/usr/lib64/python3.6/lib-dynload/_tkinter.cpython-36m-x86_64-linux-gnu.so' ... Argh! MPL *skips* the systemwide defaults (/etc/matplotlibc) if it finds a user-specific matplotlibrc? That's what happened. I set a few personal things in my user matplotlibrc, but not the backend. When I removed my customization, TkAgg was selected again. A tough lesson. This bug has been accepted upstream. https://github.com/matplotlib/matplotlib/issues/6320 Upstream plans to fix this:
https://github.com/matplotlib/matplotlib/issues/11279
https://github.com/matplotlib/matplotlib/pull/9528
Anyone interested in helping out should get involved there. Once it's fixed upstream, Fedora should pick up the change in the usual way.
|