Bug 2328713 - python-matplotlib fails to build with Python 3.14: RecursionError: maximum recursion depth exceeded
Summary: python-matplotlib fails to build with Python 3.14: RecursionError: maximum re...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-matplotlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Karolina Surma
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 2331350
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2024-11-25 16:37 UTC by Karolina Surma
Modified: 2025-05-28 09:00 UTC (History)
7 users (show)

Fixed In Version: python-matplotlib-3.10.3-4.fc43
Clone Of:
Environment:
Last Closed: 2025-05-28 09:00:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-matplotlib pull-request 44 0 None None None 2025-01-06 15:25:05 UTC
Github matplotlib matplotlib issues 29157 0 None open FUTURE BUG: reconsider how we deep-copy path objects 2024-11-25 17:26:52 UTC
Github matplotlib matplotlib issues 29959 0 None open [MNT]: Python 3.14.0a7 test failures 2025-04-22 13:53:09 UTC
Github python cpython issues 126817 0 None open maximum recursion depth in deepcopy regression 2024-11-25 17:26:52 UTC

Description Karolina Surma 2024-11-25 16:37:51 UTC
python-matplotlib fails to build with Python 3.14.0a2.

_______________________________ test_fancy[png] ________________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

    @image_comparison(['fancy.png'], remove_text=True, style='mpl20',
                      tol=0.011 if platform.machine() == 'arm64' else 0)
    def test_fancy():
        fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
        ax.plot(np.arange(10), np.full(10, 5), np.full(10, 5), 'o--', label='line')
        ax.scatter(np.arange(10), np.arange(10, 0, -1), label='scatter')
        ax.errorbar(np.full(10, 5), np.arange(10), np.full(10, 10),
                    xerr=0.5, zerr=0.5, label='errorbar')
>       ax.legend(loc='lower left', ncols=2, title='My legend', numpoints=1)

../BUILDROOT/usr/lib64/python3.14/site-packages/mpl_toolkits/mplot3d/tests/test_legend3d.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/axes/_axes.py:342: in legend
    self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/legend.py:563: in __init__
    self._init_legend_box(handles, labels, markerfirst)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/legend.py:910: in _init_legend_box
    handle_list.append(handler.legend_artist(self, orig_handle,
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/legend_handler.py:129: in legend_artist
    artists = self.create_artists(legend, orig_handle,
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/legend_handler.py:303: in create_artists
    self.update_prop(legline, orig_handle, legend)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/legend_handler.py:88: in update_prop
    self._update_prop(legend_handle, orig_handle)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/legend_handler.py:79: in _update_prop
    self._default_update_prop(legend_handle, orig_handle)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/legend_handler.py:84: in _default_update_prop
    legend_handle.update_from(orig_handle)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/lines.py:1357: in update_from
    self._marker = MarkerStyle(marker=other._marker)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/markers.py:248: in __init__
    self._set_marker(marker)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/markers.py:323: in _set_marker
    self.__dict__ = copy.deepcopy(marker.__dict__)
/usr/lib64/python3.14/copy.py:140: in deepcopy
    y = copier(x, memo)
/usr/lib64/python3.14/copy.py:211: in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
/usr/lib64/python3.14/copy.py:147: in deepcopy
    y = copier(memo)
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/path.py:285: in __deepcopy__
    p = copy.deepcopy(super(), memo)
/usr/lib64/python3.14/copy.py:166: in deepcopy
    y = _reconstruct(x, memo, *rv)
/usr/lib64/python3.14/copy.py:243: in _reconstruct
    y = func(*args)
/usr/lib64/python3.14/copy.py:242: in <genexpr>
    args = (deepcopy(arg, memo) for arg in args)
/usr/lib64/python3.14/copy.py:147: in deepcopy
    y = copier(memo)
E   RecursionError: maximum recursion depth exceeded
!!! Recursion detected (same locals & position)

Reported upstream: https://github.com/python/cpython/issues/126817

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08302135-python-matplotlib/

For all our attempts to build python-matplotlib with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-matplotlib/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2025-01-06 15:25:05 UTC
https://src.fedoraproject.org/rpms/python-matplotlib/pull-request/44 works, but I would not merge it just yet, pending an upstream decision. In the meantime, using it in copr.

Comment 2 Aoife Moloney 2025-02-26 13:18:12 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 3 Miro Hrončok 2025-03-26 13:11:08 UTC
https://src.fedoraproject.org/rpms/python-matplotlib/pull-request/44 doesn't work anymore.

Comment 4 Karolina Surma 2025-03-26 13:16:25 UTC
There are new failures with a6:

=================================== FAILURES ===================================
____ test_interactive_thread_safety[MPLBACKEND=tkagg-BACKEND_DEPS=tkinter] _____
[gw0] linux -- Python 3.14.0 /usr/bin/python3

env = {'BACKEND_DEPS': 'tkinter', 'MPLBACKEND': 'tkagg'}

    @pytest.mark.parametrize("env", _thread_safe_backends)
    @pytest.mark.flaky(reruns=3)
    def test_interactive_thread_safety(env):
>       proc = _run_helper(_test_thread_impl, timeout=_test_timeout, extra_env=env)

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_backends_interactive.py:337: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/testing/__init__.py:126: in subprocess_run_helper
    proc = subprocess_run_for_testing(
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/testing/__init__.py:94: in subprocess_run_for_testing
    proc = subprocess.run(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = None, capture_output = False, timeout = 20, check = True
popenargs = (['/usr/bin/python3', '-c', "import importlib.util;_spec = importlib.util.spec_from_file_location('matplotlib.tests.te...py');_module = importlib.util.module_from_spec(_spec);_spec.loader.exec_module(_module);_module._test_thread_impl()"],)
kwargs = {'env': {'BACKEND_DEPS': 'tkinter', 'CC': 'gcc', 'CFLAGS': '-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-...fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ', 'COLUMNS': '80', ...}, 'stderr': -1, 'stdout': -1, 'text': True}
process = <Popen: returncode: -11 args: ['/usr/bin/python3', '-c', "import importlib.u...>
stdout = '', stderr = '', retcode = -11

    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
        or pass capture_output=True to capture both.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout (seconds) is given and the process takes too long,
         a TimeoutExpired exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass bytes or a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        By default, all communication is in bytes, and therefore any "input" should
        be bytes, and the stdout and stderr will be bytes. If in text mode, any
        "input" should be a string, and stdout and stderr will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode is
        triggered by setting any of text, encoding, errors or universal_newlines.
    
        The other arguments are the same as for the Popen constructor.
        """
        if input is not None:
            if kwargs.get('stdin') is not None:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
        if capture_output:
            if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
                raise ValueError('stdout and stderr arguments may not be used '
                                 'with capture_output.')
            kwargs['stdout'] = PIPE
            kwargs['stderr'] = PIPE
    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # Windows accumulates the output in a single blocking
                    # read() call run on child threads, with the timeout
                    # being done in a join() on those threads.  communicate()
                    # _after_ kill() is required to collect that and add it
                    # to the exception.
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # POSIX _communicate already populated the output so
                    # far into the TimeoutExpired exception.
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communicate handled that.
                process.kill()
                # We don't call process.wait() as .__exit__ does that for us.
                raise
            retcode = process.poll()
            if check and retcode:
>               raise CalledProcessError(retcode, process.args,
                                         output=stdout, stderr=stderr)
E               subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', "import importlib.util;_spec = importlib.util.spec_from_file_location('matplotlib.tests.test_backends_interactive', '/builddir/build/BUILD/python-matplotlib-3.10.0-build/BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_backends_interactive.py');_module = importlib.util.module_from_spec(_spec);_spec.loader.exec_module(_module);_module._test_thread_impl()"]' died with <Signals.SIGSEGV: 11>.

/usr/lib64/python3.14/subprocess.py:577: CalledProcessError
____________________ test_figuremanager_cleans_own_mainloop ____________________
[gw3] linux -- Python 3.14.0 /usr/bin/python3

    @pytest.mark.skipif(
        not importlib.util.find_spec('tkinter'),
        reason="missing tkinter"
    )
    @pytest.mark.skipif(
        sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(),
        reason="$DISPLAY is unset"
    )
    @pytest.mark.xfail(  # https://github.com/actions/setup-python/issues/649
        ('TF_BUILD' in os.environ or 'GITHUB_ACTION' in os.environ) and
        sys.platform == 'darwin' and sys.version_info[:2] < (3, 11),
        reason='Tk version mismatch on Azure macOS CI'
    )
    @functools.wraps(func)
    def test_func():
        # even if the package exists, may not actually be importable this can
        # be the case on some CI systems.
        pytest.importorskip('tkinter')
        try:
>           proc = subprocess_run_helper(
                func, timeout=_test_timeout, extra_env=dict(
                    MPLBACKEND="TkAgg", MPL_TEST_ESCAPE_HATCH="1"))

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_backend_tk.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/testing/__init__.py:126: in subprocess_run_helper
    proc = subprocess_run_for_testing(
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/testing/__init__.py:94: in subprocess_run_for_testing
    proc = subprocess.run(
/usr/lib64/python3.14/subprocess.py:556: in run
    stdout, stderr = process.communicate(input, timeout=timeout)
/usr/lib64/python3.14/subprocess.py:1217: in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
/usr/lib64/python3.14/subprocess.py:2121: in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Popen: returncode: -9 args: ['/usr/bin/python3', '-c', "import importlib.ut...>
endtime = 706.593722346, orig_timeout = 60, stdout_seq = [], stderr_seq = []
skip_check_and_raise = False

    def _check_timeout(self, endtime, orig_timeout, stdout_seq, stderr_seq,
                       skip_check_and_raise=False):
        """Convenience for checking if a timeout has expired."""
        if endtime is None:
            return
        if skip_check_and_raise or _time() > endtime:
>           raise TimeoutExpired(
                    self.args, orig_timeout,
                    output=b''.join(stdout_seq) if stdout_seq else None,
                    stderr=b''.join(stderr_seq) if stderr_seq else None)
E           subprocess.TimeoutExpired: Command '['/usr/bin/python3', '-c', "import importlib.util;_spec = importlib.util.spec_from_file_location('matplotlib.tests.test_backend_tk', '/builddir/build/BUILD/python-matplotlib-3.10.0-build/BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_backend_tk.py');_module = importlib.util.module_from_spec(_spec);_spec.loader.exec_module(_module);_module.test_figuremanager_cleans_own_mainloop()"]' timed out after 60 seconds

/usr/lib64/python3.14/subprocess.py:1261: TimeoutExpired

During handling of the above exception, another exception occurred:

    @pytest.mark.skipif(
        not importlib.util.find_spec('tkinter'),
        reason="missing tkinter"
    )
    @pytest.mark.skipif(
        sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(),
        reason="$DISPLAY is unset"
    )
    @pytest.mark.xfail(  # https://github.com/actions/setup-python/issues/649
        ('TF_BUILD' in os.environ or 'GITHUB_ACTION' in os.environ) and
        sys.platform == 'darwin' and sys.version_info[:2] < (3, 11),
        reason='Tk version mismatch on Azure macOS CI'
    )
    @functools.wraps(func)
    def test_func():
        # even if the package exists, may not actually be importable this can
        # be the case on some CI systems.
        pytest.importorskip('tkinter')
        try:
            proc = subprocess_run_helper(
                func, timeout=_test_timeout, extra_env=dict(
                    MPLBACKEND="TkAgg", MPL_TEST_ESCAPE_HATCH="1"))
        except subprocess.TimeoutExpired:
>           pytest.fail("Subprocess timed out")
E           Failed: Subprocess timed out

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_backend_tk.py:56: Failed

Comment 5 Karolina Surma 2025-04-03 13:22:42 UTC
Tests were skipped for now, since we can't reproduce the same failures on the source code outside of the copr/rpm context.

Comment 6 Karolina Surma 2025-04-15 18:25:42 UTC
WIth a7, we've got a bunch of beautiful test failures again:

_______________________ test_proportional_colorbars[png] _______________________
[gw3] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_proportional_colorbars[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 47.976):
E           	result_images/test_colorbar/proportional_colorbars.png
E           	result_images/test_colorbar/proportional_colorbars-expected.png
E           	result_images/test_colorbar/proportional_colorbars-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
___________________________ test_rgb_hsv_round_trip ____________________________
[gw3] linux -- Python 3.14.0 /usr/bin/python3

x = array([0.5488135 , 0.71518937, 0.60276338, ..., 0.31486942, 0.95593047,
       0.76646949], shape=(750000,))
y = array([], dtype=float64)

    def compare(x, y):
        try:
            if npany(isinf(x)) or npany(isinf(y)):
                xinfid = isinf(x)
                yinfid = isinf(y)
                if not (xinfid == yinfid).all():
                    return False
                # if one item, x and y is +- inf
                if x.size == y.size == 1:
                    return x == y
                x = x[~xinfid]
                y = y[~yinfid]
        except (TypeError, NotImplementedError):
            pass
    
        # make sure y is an inexact type to avoid abs(MIN_INT); will cause
        # casting of x later.
        dtype = result_type(y, 1.)
        y = np.asanyarray(y, dtype)
>       z = abs(x - y)
E       ValueError: operands could not be broadcast together with shapes (750000,) (0,)

/usr/lib64/python3.14/site-packages/numpy/testing/_private/utils.py:1165: ValueError

During handling of the above exception, another exception occurred:

    def test_rgb_hsv_round_trip():
        for a_shape in [(500, 500, 3), (500, 3), (1, 3), (3,)]:
            np.random.seed(0)
            tt = np.random.random(a_shape)
>           assert_array_almost_equal(
                tt, mcolors.hsv_to_rgb(mcolors.rgb_to_hsv(tt)))
E           ValueError: 
E           error during assertion:
E           
E           Traceback (most recent call last):
E             File "/usr/lib64/python3.14/site-packages/numpy/testing/_private/utils.py", line 851, in assert_array_compare
E               val = comparison(x, y)
E             File "/usr/lib64/python3.14/site-packages/numpy/testing/_private/utils.py", line 1165, in compare
E               z = abs(x - y)
E                       ~~^~~
E           ValueError: operands could not be broadcast together with shapes (750000,) (0,) 
E           
E           
E           Arrays are not almost equal to 6 decimals
E            ACTUAL: array([0.548814, 0.715189, 0.602763, ..., 0.314869, 0.95593 , 0.766469],
E                 shape=(750000,))
E            DESIRED: array([], dtype=float64)

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_colors.py:903: ValueError
_____________________ test_light_source_topo_surface[png] ______________________
[gw3] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_light_source_topo_surface[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 31.976):
E           	result_images/test_colors/light_source_shading_topo.png
E           	result_images/test_colors/light_source_shading_topo-expected.png
E           	result_images/test_colors/light_source_shading_topo-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
_____________________________ test_hexbin_log[png] _____________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_hexbin_log[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 35.932):
E           	result_images/test_axes/hexbin_log.png
E           	result_images/test_axes/hexbin_log-expected.png
E           	result_images/test_axes/hexbin_log-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
___________________________ test_hexbin_linear[png] ____________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_hexbin_linear[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 20.427):
E           	result_images/test_axes/hexbin_linear.png
E           	result_images/test_axes/hexbin_linear-expected.png
E           	result_images/test_axes/hexbin_linear-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
_______________________________ test_labels[png] _______________________________
[gw3] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_labels[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 30.600):
E           	result_images/test_contour/contour_test_label_transforms.png
E           	result_images/test_contour/contour_test_label_transforms-expected.png
E           	result_images/test_contour/contour_test_label_transforms-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
______________________________ test_symlog2[pdf] _______________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'pdf', 'request': <FixtureRequest for <Function test_symlog2[pdf]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 12.445):
E           	result_images/test_axes/symlog2_pdf.png
E           	result_images/test_axes/symlog2-expected_pdf.png
E           	result_images/test_axes/symlog2_pdf-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
____________________ test_mollweide_forward_inverse_closure ____________________
[gw1] linux -- Python 3.14.0 /usr/bin/python3

    def test_mollweide_forward_inverse_closure():
        # test that the round-trip Mollweide forward->inverse transformation is an
        # approximate identity
        fig = plt.figure()
        ax = fig.add_subplot(projection='mollweide')
    
        # set up 1-degree grid in longitude, latitude
        lon = np.linspace(-np.pi, np.pi, 360)
        # The poles are degenerate and thus sensitive to floating point precision errors
        lat = np.linspace(-np.pi / 2.0, np.pi / 2.0, 180)[1:-1]
        lon, lat = np.meshgrid(lon, lat)
        ll = np.vstack((lon.flatten(), lat.flatten())).T
    
        # perform forward transform
>       xy = ax.transProjection.transform(ll)

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_axes.py:4817: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/transforms.py:1501: in transform
    res = self.transform_affine(self.transform_non_affine(values))
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/projections/geo.py:372: in transform_non_affine
    delta, large_delta = d(theta)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

theta = array([ 3.22129331e+27,  3.22129331e+27,  3.22129331e+27, ...,
       -3.22129331e+27, -3.22129331e+27, -3.22129331e+27], shape=(61200,))

    def d(theta):
>       delta = (-(theta + np.sin(theta) - pi_sin_l)
                 / (1 + np.cos(theta)))
E       RuntimeWarning: overflow encountered in divide

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/projections/geo.py:355: RuntimeWarning
____________________ test_mollweide_inverse_forward_closure ____________________
[gw1] linux -- Python 3.14.0 /usr/bin/python3

    def test_mollweide_inverse_forward_closure():
        # test that the round-trip Mollweide inverse->forward transformation is an
        # approximate identity
        fig = plt.figure()
        ax = fig.add_subplot(projection='mollweide')
    
        # set up grid in x, y
        x = np.linspace(0, 1, 500)
        x, y = np.meshgrid(x, x)
        xy = np.vstack((x.flatten(), y.flatten())).T
    
        # perform inverse transform
        ll = ax.transProjection.inverted().transform(xy)
    
        # perform forward transform
>       xy2 = ax.transProjection.transform(ll)

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_axes.py:4841: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/transforms.py:1501: in transform
    res = self.transform_affine(self.transform_non_affine(values))
../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/projections/geo.py:372: in transform_non_affine
    delta, large_delta = d(theta)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

theta = array([ 0.        ,  0.        ,  0.        , ..., -3.14323857,
       -3.14323857, -3.14323857], shape=(250000,))

    def d(theta):
>       delta = (-(theta + np.sin(theta) - pi_sin_l)
                 / (1 + np.cos(theta)))
E       RuntimeWarning: divide by zero encountered in divide

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/projections/geo.py:355: RuntimeWarning
___________________________ test_specgram_angle[png] ___________________________
[gw1] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_specgram_angle[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 23.460):
E           	result_images/test_axes/specgram_phase_freqs.png
E           	result_images/test_axes/specgram_phase_freqs-expected.png
E           	result_images/test_axes/specgram_phase_freqs-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
_______________________ test_mask_image_over_under[png] ________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_mask_image_over_under[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 41.585):
E           	result_images/test_image/mask_image_over_under.png
E           	result_images/test_image/mask_image_over_under-expected.png
E           	result_images/test_image/mask_image_over_under-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
___________________________ test_rgba_antialias[png] ___________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_rgba_antialias[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 59.938):
E           	result_images/test_image/rgba_antialias.png
E           	result_images/test_image/rgba_antialias-expected.png
E           	result_images/test_image/rgba_antialias-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
____________________________ test_downsampling[png] ____________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_downsampling[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 71.138):
E           	result_images/test_image/downsampling.png
E           	result_images/test_image/downsampling-expected.png
E           	result_images/test_image/downsampling-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure
_____________________________ test_fft_peaks[png] ______________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

    @image_comparison(['fft_peaks'], remove_text=True)
    def test_fft_peaks():
        fig, ax = plt.subplots()
        t = np.arange(65536)
        p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t)))))
    
        # Ensure that the path's transform takes the new axes limits into account.
        fig.canvas.draw()
        path = p1[0].get_path()
        transform = p1[0].get_transform()
        path = transform.transform_path(path)
        simplified = path.cleaned(simplify=True)
    
>       assert simplified.vertices.size == 36
E       assert 60 == 36
E        +  where 60 = array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n       ...39511],\n       [544.36228571,  48.02106443],\n       [544.36228571,  48.02106443],\n       [  0.        ,   0.        ]]).size
E        +    where array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n       ...39511],\n       [544.36228571,  48.02106443],\n       [544.36228571,  48.02106443],\n       [  0.        ,   0.        ]]) = Path(array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n  ... array([1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n       2, 2, 2, 2, 2, 2, 2, 0], dtype=uint8)).vertices

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_simplification.py:421: AssertionError
_____________________________ test_fft_peaks[pdf] ______________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

    @image_comparison(['fft_peaks'], remove_text=True)
    def test_fft_peaks():
        fig, ax = plt.subplots()
        t = np.arange(65536)
        p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t)))))
    
        # Ensure that the path's transform takes the new axes limits into account.
        fig.canvas.draw()
        path = p1[0].get_path()
        transform = p1[0].get_transform()
        path = transform.transform_path(path)
        simplified = path.cleaned(simplify=True)
    
>       assert simplified.vertices.size == 36
E       assert 60 == 36
E        +  where 60 = array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n       ...39511],\n       [544.36228571,  48.02106443],\n       [544.36228571,  48.02106443],\n       [  0.        ,   0.        ]]).size
E        +    where array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n       ...39511],\n       [544.36228571,  48.02106443],\n       [544.36228571,  48.02106443],\n       [  0.        ,   0.        ]]) = Path(array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n  ... array([1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n       2, 2, 2, 2, 2, 2, 2, 0], dtype=uint8)).vertices

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_simplification.py:421: AssertionError
_____________________________ test_fft_peaks[svg] ______________________________
[gw0] linux -- Python 3.14.0 /usr/bin/python3

    @image_comparison(['fft_peaks'], remove_text=True)
    def test_fft_peaks():
        fig, ax = plt.subplots()
        t = np.arange(65536)
        p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t)))))
    
        # Ensure that the path's transform takes the new axes limits into account.
        fig.canvas.draw()
        path = p1[0].get_path()
        transform = p1[0].get_transform()
        path = transform.transform_path(path)
        simplified = path.cleaned(simplify=True)
    
>       assert simplified.vertices.size == 36
E       assert 60 == 36
E        +  where 60 = array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n       ...39511],\n       [544.36228571,  48.02106443],\n       [544.36228571,  48.02106443],\n       [  0.        ,   0.        ]]).size
E        +    where array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n       ...39511],\n       [544.36228571,  48.02106443],\n       [544.36228571,  48.02106443],\n       [  0.        ,   0.        ]]) = Path(array([[ 80.        ,  48.02106438],\n       [ 84.18057143,  48.13098965],\n       [ 84.44274286,  48.3183187 ],\n  ... array([1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n       2, 2, 2, 2, 2, 2, 2, 0], dtype=uint8)).vertices

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_simplification.py:421: AssertionError
___________________________ test_quiver_memory_leak ____________________________
[gw2] linux -- Python 3.14.0 /usr/bin/python3

    @pytest.mark.skipif(platform.python_implementation() != 'CPython',
                        reason='Requires CPython')
    def test_quiver_memory_leak():
        fig, ax = plt.subplots()
    
        Q = draw_quiver(ax)
        ttX = Q.X
        Q.remove()
    
        del Q
    
>       assert sys.getrefcount(ttX) == 2
E       assert 1 == 2
E        +  where 1 = <built-in function getrefcount>(array([0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0,\n       1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1,\n       2, 3, 4, 5, 6]))
E        +    where <built-in function getrefcount> = sys.getrefcount

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_quiver.py:33: AssertionError
_________________________ test_quiver_key_memory_leak __________________________
[gw2] linux -- Python 3.14.0 /usr/bin/python3

    @pytest.mark.skipif(platform.python_implementation() != 'CPython',
                        reason='Requires CPython')
    def test_quiver_key_memory_leak():
        fig, ax = plt.subplots()
    
        Q = draw_quiver(ax)
    
        qk = ax.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$',
                          labelpos='W',
                          fontproperties={'weight': 'bold'})
>       assert sys.getrefcount(qk) == 3
E       assert 2 == 3
E        +  where 2 = <built-in function getrefcount>(<matplotlib.quiver.QuiverKey object at 0x7f2621cf0440>)
E        +    where <built-in function getrefcount> = sys.getrefcount

../BUILDROOT/usr/lib64/python3.14/site-packages/matplotlib/tests/test_quiver.py:46: AssertionError
_______________________ test_tri_smooth_contouring[png] ________________________
[gw2] linux -- Python 3.14.0 /usr/bin/python3

args = ()
kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_tri_smooth_contouring[png]>>}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 123.603):
E           	result_images/test_triangulation/tri_smooth_contouring.png
E           	result_images/test_triangulation/tri_smooth_contouring-expected.png
E           	result_images/test_triangulation/tri_smooth_contouring-failed-diff.png

/usr/lib64/python3.14/contextlib.py:85: ImageComparisonFailure

Comment 7 Karolina Surma 2025-04-22 13:53:10 UTC
I managed to run the test suite on the main branch of the upstream project, with the same 19 tests failing, reported: https://github.com/matplotlib/matplotlib/issues/29959


Note You need to log in before you can comment on or make changes to this bug.