Skip to content

pillow 7.0.0 has removed PILLOW_VERSION #1718

@Gijs-Koot

Description

@Gijs-Koot

In the newest version of pillow, the attribute PILLOW_VERSION is removed in favor of PIL.__version__. torchvision relies on the old behaviour and breaks on import with

>>> import torchvision
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./venv/lib/python3.7/site-packages/torchvision/__init__.py", line 4, in <module>
    from torchvision import datasets
  File "./venv/lib/python3.7/site-packages/torchvision/datasets/__init__.py", line 9, in <module>
    from .fakedata import FakeData
  File "./venv/lib/python3.7/site-packages/torchvision/datasets/fakedata.py", line 3, in <module>
    from .. import transforms
  File "./venv/lib/python3.7/site-packages/torchvision/transforms/__init__.py", line 1, in <module>
    from .transforms import *
  File "./venv/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 17, in <module>
    from . import functional as F
  File "./venv/lib/python3.7/site-packages/torchvision/transforms/functional.py", line 5, in <module>
    from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (./venv/lib/python3.7/site-packages/PIL/__init__.py)

See for reference this issue in Pillow python-pillow/Pillow#4130.

I don't know if version 7 of Pillow breaks torchvision in other ways. Instead of resolving this directly, the <7.0 dependency rule could also be added to the requirements of torchvision.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions