Could not import PILLOW_VERSION from PIL

Downgrade pillow if you don't need latest features

pip uninstall pillow
pip install "pillow<7"

Or for anaconda,

conda install -c anaconda pillow<7

Pillow 7.0.0 removed PILLOW_VERSION, you should use __version__ in your own code instead.

  • https://pillow.readthedocs.io/en/stable/deprecations.html#pillow-version-constant

Edit (2020-01-16):

If using torchvision, this has been fixed in v0.5.0. To fix:

  1. Require torchvision>=0.5.0
  2. If Pillow was temporarily pinned, remove the pin

Old info (2020-01-09):

If using torchvision, there is a release planned this week (week 2, 2020) to fix it:

  • https://github.com/pytorch/vision/issues/1712#issuecomment-570286349

The options are:

  • wait for the new torchvision release
  • use the master version of torchvision (eg. pip install -U git+https://github.com/pytorch/vision)
  • install torchvision from a nightly, which also requires a pytorch from a nightly version
  • or install Pillow<7 (eg. pip install "pillow<7")