Incompatibility with python3-pil v7.0

Bug #1897283 reported by Nicolas Moriniere
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
matplotlib (Ubuntu)
New
Undecided
Unassigned

Bug Description

I am using Ubuntu 20.04.1 LTS (including python3-matplotlib 3.1.2-1ubuntu4)

To save a figure using matplotlib.pyplot into a jpg file, matplotlib uses Python Imaging Library (PIL). Unfortunately even if we install the package python3-pil 7.0.0-4ubuntu0.1 it fails:

File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 1961, in _get_output_canvas
        raise ValueError(
    ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)

The reason is matplotlib detect PIL version by doing so (in file backend_bases.py line 57):
from PIL import PILLOW_VERSION

PILLOW_VERSION has been removed since PIL version 7.0 to be replaced by PIL.__version__

To solve this issue it seems that you have to upgrade python3-matplotlib package at least to version 3.3 (the version packaged for ubuntu 20.10, I think)

Revision history for this message
Satoru Takeuchi (satoru-takeuchi) wrote :

I encountered the same problem.

> To solve this issue it seems that you have to upgrade python3-matplotlib package at least to version 3.3 (the version packaged for ubuntu 20.10, I think)

v3.1.3 also supports pillow >= 7.0. This version might be more appropriate.

https://github.com/matplotlib/matplotlib/releases/tag/v3.1.3
> - support pillow >= 7

Original fix.
https://github.com/matplotlib/matplotlib/pull/16086

This fix is applied to v3.1.3
https://github.com/matplotlib/matplotlib/blob/v3.1.3/lib/matplotlib/backend_bases.py#L57

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.