Skip to content

Commit 5e858a6

Browse files
pillow-dependency update
1 parent 0984694 commit 5e858a6

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

INSTALL.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Matplotlib requires the following dependencies:
142142
* `pytz <http://pytz.sourceforge.net/>`__
143143
* FreeType (>= 2.3)
144144
* `cycler <http://matplotlib.org/cycler/>`__ (>= 0.10.0)
145-
* `six <https://pypi.python.org/pypi/six>`_
145+
* `six <https://pypi.python.org/pypi/six>`_ (>= 1.10)
146146
* `kiwisolver <https://github.com/nucleic/kiwi>`__ (>= 1.0.0)
147147

148148
Optionally, you can also install a number of packages to enable better user
@@ -166,7 +166,7 @@ etc., you can install the following:
166166
<https://libav.org/avconv.html>`_: for saving movies;
167167
* `ImageMagick <https://www.imagemagick.org/script/index.php>`_: for saving
168168
animated gifs;
169-
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>=2.0): for a larger selection of
169+
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>=3.4): for a larger selection of
170170
image file formats: JPEG, BMP, and TIFF image files;
171171
* `LaTeX <https://miktex.org/>`_ and `GhostScript
172172
<https://ghostscript.com/download/>`_ (for rendering text with LaTeX).

lib/matplotlib/backend_bases.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@
5555

5656
try:
5757
from PIL import Image
58-
_has_pil = True
58+
from PIL import PILLOW_VERSION
59+
from distutils.version import LooseVersion
60+
if LooseVersion(PILLOW_VERSION) >= LooseVersion("3.4"):
61+
_has_pil = True
62+
else:
63+
_has_pil = False
5964
del Image
6065
except ImportError:
6166
_has_pil = False

lib/matplotlib/backends/backend_agg.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@
4242
from matplotlib.backends._backend_agg import RendererAgg as _RendererAgg
4343
from matplotlib import _png
4444

45-
try:
45+
from matplotlib.backend_bases import _has_pil
46+
47+
if _has_pil:
4648
from PIL import Image
47-
_has_pil = True
48-
except ImportError:
49-
_has_pil = False
5049

5150
backend_version = 'v2.2'
5251

0 commit comments

Comments
 (0)