Skip to content

[Bug]: backend from matplotlibrc not used #21718

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

Closed
brobr opened this issue Nov 22, 2021 · 7 comments
Closed

[Bug]: backend from matplotlibrc not used #21718

brobr opened this issue Nov 22, 2021 · 7 comments

Comments

@brobr
Copy link

brobr commented Nov 22, 2021

Bug summary

Import of matplotlib leads to KeyError: 'webagg.port' on Slackware64-current.
Seems related to #21684, #21662

During building matplotlib from pypi.org source-tar.gz, patches corresponding to above commits had been applied, giving this
matplotlibrc:

..
## ***************************************************************************
## * BACKENDS *
## ***************************************************************************
## The default backend. If you omit this parameter, the first working
## backend from the following list is used:
## MacOSX QtAgg Gtk4Agg Gtk3Agg TkAgg WxAgg Agg
## Other choices include:
## QtCairo GTK4Cairo GTK3Cairo TkCairo WxCairo Cairo
## Qt5Agg Qt5Cairo Wx # deprecated.
## PS PDF SVG Template
## You can also deploy your own backend outside of Matplotlib by referring to
## the module name (which must be in the PYTHONPATH) as 'module://my_backend'.
#backend: QtAgg
..

Still, also after commenting out #backend: QtAgg in either
~/.config/matplotlib/matplotlibrc
or in
/usr/lib64/python3.9/site-packages/matplotlib/mpl-data/matplotlibrc

results in this KeyError: 'webagg.port'

Code for reproduction

bash-5.1$ python
>>> import matplotlib

Actual outcome

bash-5.1$ python
Python 3.9.9 (main, Nov 20 2021, 19:41:34)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib64/python3.9/site-packages/matplotlib/init.py", line 895, in
defaultParams = rcsetup.defaultParams = {
File "/usr/lib64/python3.9/site-packages/matplotlib/init.py", line 898, in
rcParamsDefault[key]),
File "/usr/lib64/python3.9/site-packages/matplotlib/init.py", line 674, in getitem
return dict.getitem(self, key)
KeyError: 'webagg.port'

Expected outcome

no import error, i.e:

bash-5.1$ python
Python 3.9.9 (main, Nov 20 2021, 19:41:34)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>

Additional information

With matplotlib-3.4.3 nothing like this.

Operating system

Slackware64-15.0-RC2

Matplotlib Version

3.5.0

Matplotlib Backend

not possible

Python version

3.9.9

Jupyter version

not used

Installation

from source (.tar.gz)

@QuLogic
Copy link
Member

QuLogic commented Nov 22, 2021

Duplicate of #21660

@QuLogic QuLogic marked this as a duplicate of #21660 Nov 22, 2021
@QuLogic QuLogic closed this as completed Nov 22, 2021
@brobr
Copy link
Author

brobr commented Nov 22, 2021

I checked that bug-report issue #21660 but despite the changes done in response to that, as mentioned at the top, the problem is still there... unless that problem has not been solved and then this would be a duplicate.

What I find baffling is that the matplotlibrc seems to have no impact (btw on 3.4.3 the QtAgg is not appreciated; best way to solve that is to remove the whole /.config/matplotlib/matploblibrc )

@QuLogic
Copy link
Member

QuLogic commented Nov 22, 2021

There has been no release with the fix in that report; did you patch it yourself?

@brobr
Copy link
Author

brobr commented Nov 22, 2021

@QuLogic
Copy link
Member

QuLogic commented Nov 23, 2021

Did you apply the patch and then build from a completely clean tree, or apply the patch to the build you already made?

@brobr
Copy link
Author

brobr commented Nov 23, 2021

No; patching should have been straight on the source, i.e. a 3.5.0.tar.gz archive after it was unpacked to /tmp, just before building (maybe the script used for this shows that to you: matplotlib_SlackBuild.txt)

@brobr
Copy link
Author

brobr commented Dec 5, 2021

Ok, sorry; I missed updating some dependencies (as I noticed when letting pip do it all; in a virtual environment). After putting these in place it all worked as usual (with the above patches included).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants