Skip to content

pillow-dependency update #11132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Matplotlib requires the following dependencies:
* `pytz <http://pytz.sourceforge.net/>`__
* FreeType (>= 2.3)
* `cycler <http://matplotlib.org/cycler/>`__ (>= 0.10.0)
* `six <https://pypi.python.org/pypi/six>`_
* `six <https://pypi.python.org/pypi/six>`_ (>= 1.10)
* `kiwisolver <https://github.com/nucleic/kiwi>`__ (>= 1.0.0)

Optionally, you can also install a number of packages to enable better user
Expand All @@ -166,7 +166,7 @@ etc., you can install the following:
<https://libav.org/avconv.html>`_: for saving movies;
* `ImageMagick <https://www.imagemagick.org/script/index.php>`_: for saving
animated gifs;
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>=2.0): for a larger selection of
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>=3.4): for a larger selection of
image file formats: JPEG, BMP, and TIFF image files;
* `LaTeX <https://miktex.org/>`_ and `GhostScript
<https://ghostscript.com/download/>`_ (for rendering text with LaTeX).
Expand Down
7 changes: 6 additions & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@

try:
from PIL import Image
_has_pil = True
from PIL import PILLOW_VERSION
from distutils.version import LooseVersion
if LooseVersion(PILLOW_VERSION) >= LooseVersion("3.4"):
_has_pil = True
else:
_has_pil = False
del Image
except ImportError:
_has_pil = False
Expand Down
7 changes: 3 additions & 4 deletions lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
from matplotlib.backends._backend_agg import RendererAgg as _RendererAgg
from matplotlib import _png

try:
from matplotlib.backend_bases import _has_pil

if _has_pil:
from PIL import Image
_has_pil = True
except ImportError:
_has_pil = False

backend_version = 'v2.2'

Expand Down