Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1789664 - python-matplotlib fails to build with Python 3.9
Summary: python-matplotlib fails to build with Python 3.9
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-matplotlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON39
TreeView+ depends on / blocked
 
Reported: 2020-01-10 03:31 UTC by Charalampos Stratakis
Modified: 2020-01-22 12:26 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-22 12:26:15 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github matplotlib matplotlib pull 16086 0 None None None 2020-01-10 05:30:37 UTC

Description Charalampos Stratakis 2020-01-10 03:31:49 UTC
python-matplotlib fails to build with Python 3.9.0a2.

Error report:

=================================== FAILURES ===================================
_____________________________ test_pil_kwargs_tiff _____________________________
[gw2] linux -- Python 3.9.0 /usr/bin/python3

    def test_pil_kwargs_tiff():
        Image = pytest.importorskip("PIL.Image")
        from PIL.TiffTags import TAGS_V2 as TAGS
        buf = io.BytesIO()
        pil_kwargs = {"description": "test image"}
>       plt.figure().savefig(buf, format="tiff", pil_kwargs=pil_kwargs)

../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/tests/test_agg.py:260: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/figure.py:2180: in savefig
    self.canvas.print_figure(fname, **kwargs)
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/backend_bases.py:2021: in print_figure
    canvas = self._get_output_canvas(format)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <matplotlib.backends.backend_agg.FigureCanvasAgg object at 0x7f342dfa04f0>
fmt = 'tiff'

    def _get_output_canvas(self, fmt):
        """
        Return a canvas suitable for saving figures to a specified file format.
    
        If necessary, this function will switch to a registered backend that
        supports the format.
        """
        # Return the current canvas if it supports the requested format.
        if hasattr(self, 'print_{}'.format(fmt)):
            return self
        # Return a default canvas for the requested format, if it exists.
        canvas_class = get_registered_canvas_class(fmt)
        if canvas_class:
            return self.switch_backends(canvas_class)
        # Else report error for unsupported format.
>       raise ValueError(
            "Format {!r} is not supported (supported formats: {})"
            .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
E       ValueError: Format 'tiff' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)

../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/backend_bases.py:1961: ValueError
________________________________ test_jpeg_dpi _________________________________
[gw0] linux -- Python 3.9.0 /usr/bin/python3

    @pytest.mark.backend('Agg')
    def test_jpeg_dpi():
        Image = pytest.importorskip("PIL.Image")
        # Check that dpi is set correctly in jpg files.
        plt.plot([0, 1, 2], [0, 1, 0])
        buf = io.BytesIO()
>       plt.savefig(buf, format="jpg", dpi=200)

../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/tests/test_agg.py:239: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/pyplot.py:722: in savefig
    res = fig.savefig(*args, **kwargs)
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/figure.py:2180: in savefig
    self.canvas.print_figure(fname, **kwargs)
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/backend_bases.py:2021: in print_figure
    canvas = self._get_output_canvas(format)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <matplotlib.backends.backend_agg.FigureCanvasAgg object at 0x7f51b8384520>
fmt = 'jpg'

    def _get_output_canvas(self, fmt):
        """
        Return a canvas suitable for saving figures to a specified file format.
    
        If necessary, this function will switch to a registered backend that
        supports the format.
        """
        # Return the current canvas if it supports the requested format.
        if hasattr(self, 'print_{}'.format(fmt)):
            return self
        # Return a default canvas for the requested format, if it exists.
        canvas_class = get_registered_canvas_class(fmt)
        if canvas_class:
            return self.switch_backends(canvas_class)
        # Else report error for unsupported format.
>       raise ValueError(
            "Format {!r} is not supported (supported formats: {})"
            .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
E       ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)

../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/backend_bases.py:1961: ValueError
_______________________________ test_jpeg_alpha ________________________________
[gw1] linux -- Python 3.9.0 /usr/bin/python3

    def test_jpeg_alpha():
        Image = pytest.importorskip('PIL.Image')
    
        plt.figure(figsize=(1, 1), dpi=300)
        # Create an image that is all black, with a gradient from 0-1 in
        # the alpha channel from left to right.
        im = np.zeros((300, 300, 4), dtype=float)
        im[..., 3] = np.linspace(0.0, 1.0, 300)
    
        plt.figimage(im)
    
        buff = io.BytesIO()
        with rc_context({'savefig.facecolor': 'red'}):
>           plt.savefig(buff, transparent=True, format='jpg', dpi=300)

../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/tests/test_image.py:573: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/pyplot.py:722: in savefig
    res = fig.savefig(*args, **kwargs)
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/figure.py:2180: in savefig
    self.canvas.print_figure(fname, **kwargs)
../../BUILDROOT/python-matplotlib-3.1.2-1.fc32.x86_64/usr/lib64/python3.9/site-packages/matplotlib/backend_bases.py:2021: in print_figure
    canvas = self._get_output_canvas(format)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <matplotlib.backends.backend_agg.FigureCanvasAgg object at 0x7f9c07a06610>
fmt = 'jpg'

    def _get_output_canvas(self, fmt):
        """
        Return a canvas suitable for saving figures to a specified file format.
    
        If necessary, this function will switch to a registered backend that
        supports the format.
        """
        # Return the current canvas if it supports the requested format.
        if hasattr(self, 'print_{}'.format(fmt)):
            return self
        # Return a default canvas for the requested format, if it exists.
        canvas_class = get_registered_canvas_class(fmt)
        if canvas_class:
            return self.switch_backends(canvas_class)
        # Else report error for unsupported format.
>       raise ValueError(
            "Format {!r} is not supported (supported formats: {})"
            .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
E       ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)

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

For all our attempts to build python-matplotlib with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/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.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33, but the initial bootstrapping has already started.
A build failure this early in the bootstrap sequence blocks us very much.

Comment 1 Elliott Sales de Andrade 2020-01-10 05:30:37 UTC
This is because of Pillow 7, not Python 3.9. It that's the only failure, it should be good with a backport.

Comment 2 Charalampos Stratakis 2020-01-14 03:13:16 UTC
Indeed, by backporting the fix matplotlib build successfully.


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