#29790·matplotlib

[Bug]: test_backend_pgf.py::test_rcupdate fails with texlive 2025

Author: MeggyCalCreated Mar 21, 2025Updated Sep 28, 2026
Labelstopic: text/usetex

Bug summary

Hi all, thanks for this useful library! Sadly, with texlive 20250308 test_backend_pgf.py::test_rcupdate image comparison fails in matplotlib 3.10.1. I don't have the images, as the tests ran on an external system.

Code for reproduction

python
run `test_backend_pgf.py::test_rcupdate`

Actual outcome

I am sorry, as I said, I don't have the images and the log is boring otherwise:

[  503s] ________________________________ test_rcupdate _________________________________
[  503s] 
[  503s]     @needs_pgf_xelatex
[  503s]     @needs_pgf_pdflatex
[  503s]     @mpl.style.context('default')
[  503s]     @pytest.mark.backend('pgf')
[  503s]     def test_rcupdate():
[  503s]         rc_sets = [{'font.family': 'sans-serif',
[  503s]                     'font.size': 30,
[  503s]                     'figure.subplot.left': .2,
[  503s]                     'lines.markersize': 10,
[  503s]                     'pgf.rcfonts': False,
[  503s]                     'pgf.texsystem': 'xelatex'},
[  503s]                    {'font.family': 'monospace',
[  503s]                     'font.size': 10,
[  503s]                     'figure.subplot.left': .1,
[  503s]                     'lines.markersize': 20,
[  503s]                     'pgf.rcfonts': False,
[  503s]                     'pgf.texsystem': 'pdflatex',
[  503s]                     'pgf.preamble': ('\\\\usepackage[utf8x]{inputenc}'
[  503s]                                      '\\\\usepackage[T1]{fontenc}'
[  503s]                                      '\\\\usepackage{sfmath}')}]
[  503s]         tol = [0, 13.2] if _old_gs_version else [0, 0]
[  503s]         for i, rc_set in enumerate(rc_sets):
[  503s]             with mpl.rc_context(rc_set):
[  503s]                 for substring, pkg in [('sfmath', 'sfmath'), ('utf8x', 'ucs')]:
[  503s]                     if (substring in mpl.rcParams['pgf.preamble']
[  503s]                             and not _has_tex_package(pkg)):
[  503s]                         pytest.skip(f'needs {pkg}.sty')
[  503s]                 create_figure()
[  503s] >               compare_figure(f'pgf_rcupdate{i + 1}.pdf', tol=tol[i])
[  503s] 
[  503s] /usr/lib64/python3.11/site-packages/matplotlib/tests/test_backend_pgf.py:142: 
[  503s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  503s] 
[  503s] fname = 'pgf_rcupdate2.pdf', savefig_kwargs = {}, tol = 0
[  503s] 
[  503s]     def compare_figure(fname, savefig_kwargs={}, tol=0):
[  503s]         actual = os.path.join(result_dir, fname)
[  503s]         plt.savefig(actual, **savefig_kwargs)
[  503s]     
[  503s]         expected = os.path.join(result_dir, "expected_%s" % fname)
[  503s]         shutil.copyfile(os.path.join(baseline_dir, fname), expected)
[  503s]         err = compare_images(expected, actual, tol=tol)
[  503s]         if err:
[  503s] >           raise ImageComparisonFailure(err)
[  503s] E           matplotlib.testing.exceptions.ImageComparisonFailure: Error: Image files did not match.
[  503s] E             RMS Value: 4.23523981360686
[  503s] E             Expected:  
[  503s] E               /home/abuild/rpmbuild/BUILD/python-matplotlib-test-3.10.1-build/matplotlib-3.10.1/result_images/test_backend_pgf/expected_pgf_rcupdate2_pdf.png
[  503s] E             Actual:    
[  503s] E               /home/abuild/rpmbuild/BUILD/python-matplotlib-test-3.10.1-build/matplotlib-3.10.1/result_images/test_backend_pgf/pgf_rcupdate2_pdf.png
[  503s] E             Difference:
[  503s] E               /home/abuild/rpmbuild/BUILD/python-matplotlib-test-3.10.1-build/matplotlib-3.10.1/result_images/test_backend_pgf/pgf_rcupdate2_pdf-failed-diff.png
[  503s] E             Tolerance: 
[  503s] E               0
[  503s] 
[  503s] /usr/lib64/python3.11/site-packages/matplotlib/tests/test_backend_pgf.py:34: ImageComparisonFailure

Expected outcome

tests pass

Additional information

No response

Operating system

openSUSE Tumbleweed

Matplotlib Version

3.10.1

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

from source (.tar.gz)