FS#41820 - [python2-matplotlib] unneeded dependency on pyqt5

Attached to Project: Community Packages
Opened by Rui Da Costa (ruidc) - Thursday, 04 September 2014, 14:01 GMT
Last edited by Bruno Pagani (ArchangeGabriel) - Sunday, 23 December 2018, 10:36 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Bruno Pagani (ArchangeGabriel)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Current package incorrectly depends on PyQt5 which is not required by upstream - it is one of several optional backends, none of which is required.
For headless server operations this is undesirable as it brings in X11 dependencies.
Build-time generated matplotlibrc settings file then specifies PyQt backend which contradicts upstream default suggestion and the stated base for other distribution binaries.
For environments already running Qt v4, this will also force incompatibilities as some setting default to Qt v5 which is not always compatible.

The best solution would be to make all GUI dependencies optional and set a matplotlibrc backend to something that requires no dependencies like PDF or PS, and raise a note to the user to install preferred GUI dependencies.

Source Notes:
requirements do not list any GUI as a requirement: https://github.com/matplotlib/matplotlib/blob/master/INSTALL#L171

from http://matplotlib.org/faq/usage_faq.html#what-is-a-backend :
With a typical installation of matplotlib, such as from a binary installer or a linux distribution package, a good default backend will already be set, allowing both interactive work and plotting from scripts, with output to the screen and/or to a file, so at least initially you will not need to use either of the two methods given above.

The default backend is set dynamically at build time and saved to matplotlibrc file (which then gets installed to
usr/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc )

this is done from https://github.com/matplotlib/matplotlib/blob/master/setup.py#L90
This task depends upon

Closed by  Bruno Pagani (ArchangeGabriel)
Sunday, 23 December 2018, 10:36 GMT
Reason for closing:  Implemented
Additional comments about closing:  Fixed, no reaction for 2 months, considering this as done.
Comment by Doug Newgard (Scimmia) - Thursday, 04 September 2014, 14:13 GMT
This is kind of a duplicate of  FS#40723 , but it's got enough more information that I'm not just going to close it.
Comment by Rui Da Costa (ruidc) - Thursday, 04 September 2014, 15:23 GMT
it was the very change to that and related tickets that caused the problem, so that is the anti-ticket. I've been discussing this with Felix over email but wanted to add this bug as a reminder and a way to communicate to other users as the closed ticket cannot take comments.

the user's question:
>or do you have a better idea of how to set a global default backend?

is solved by reading the docs upstream:
http://matplotlib.org/faq/usage_faq.html#what-is-a-backend
where it mentions to modify the matplotlibrc or use the ".use" method.
Comment by Eli Schwartz (eschwartz) - Thursday, 25 January 2018, 17:23 GMT
What is the status of this? It looks like an easy fix, so what happened to implementing it?

Comment by Balló György (City-busz) - Thursday, 25 January 2018, 18:08 GMT
I wanted to implement this, but felixonmars disagree with me, because currently matplotlib is unable to detect which backend is available on the system. So even if you install the dependencies of another backend, matplotlib still tries to use the default one configured in /usr/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc or ~/.config/matplotlib/matplotlibrc, and unable to detect alternatives.

However, applications e.g. pitivi could able to set the desired backend like this, so I don't think that it's really a problem:
https://git.gnome.org/browse/pitivi/tree/pitivi/timeline/elements.py#n23

Here is the upstream report:
https://github.com/matplotlib/matplotlib/issues/3679

And here is a large pull request, which implements fallback feature:
https://github.com/matplotlib/matplotlib/pull/9795

Once the PR is merged, we can safely remove the python2-pyqt5 dependency.

There is another task is open for this:
https://bugs.archlinux.org/task/41744
Comment by Bruno Pagani (ArchangeGabriel) - Monday, 30 July 2018, 15:54 GMT Comment by Eli Schwartz (eschwartz) - Sunday, 14 October 2018, 05:57 GMT
In upstream release 3.0.0:

The first release of the Matplotlib 3.0 series

This is the first version of Matplotlib to only support Python 3.

Highlights of this release include:

- GUI backend is selected at run-time based on what toolkits are
installed. A GUI toolkit will not be selected on a headless
server.
Comment by Bruno Pagani (ArchangeGabriel) - Wednesday, 24 October 2018, 11:48 GMT
Yeah, but the issue is python2-matplotlib now. Should we change the default backend to something dependency less like Agg?
Comment by Bruno Pagani (ArchangeGabriel) - Wednesday, 24 October 2018, 12:31 GMT
I propose to use a setup.cfg file to set the default to Agg as advised here https://github.com/matplotlib/matplotlib/blob/v2.2.x/setup.cfg.template#L80
Comment by Bruno Pagani (ArchangeGabriel) - Wednesday, 24 October 2018, 22:18 GMT
python2-matplotib 2.2.3-3 in [community-testing] defaults to Agg and print a post_install (as well as post_upgrade when upgrading to this version) message about this change and the needs to install optdep(s) and set the backend to use a different one.

Loading...