The latest version of Pillow 7.0.0 will kill the pytorch transform.

It remains the title.

If I upgrade to the latest version of pillow 7.0.0 and run the code that contains the pytorch transform, I get:

  File "train.py", line 6, in <module>
    from utils.datasets import *
  File "/home/jun/Desktop/work_space/sportip/hogehoge/utils/datasets.py", line 12, in <module>
    import torchvision.transforms as transforms
  File "/home/jun/.local/share/virtualenvs/hogehoge-IBQiZg8J/lib/python3.6/site-packages/torchvision/__init__.py", line 4, in <module>
    from torchvision import datasets
  File "/home/jun/.local/share/virtualenvs/hogehoge-IBQiZg8J/lib/python3.6/site-packages/torchvision/datasets/__init__.py", line 9, in <module>
    from .fakedata import FakeData
  File "/home/jun/.local/share/virtualenvs/hogehoge-IBQiZg8J/lib/python3.6/site-packages/torchvision/datasets/fakedata.py", line 3, in <module>
    from .. import transforms
  File "/home/jun/.local/share/virtualenvs/hogehoge-IBQiZg8J/lib/python3.6/site-packages/torchvision/transforms/__init__.py", line 1, in <module>
    from .transforms import *
  File "/home/jun/.local/share/virtualenvs/hogehoge-IBQiZg8J/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 17, in <module>
    from . import functional as F
  File "/home/jun/.local/share/virtualenvs/hogehoge-IBQiZg8J/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 5, in <module>
    from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION'

This is due to pillow version 7.0.0 released in 2020.

https://pypi.org/project/Pillow/7.0.0/

To avoid this, specify the previous version when installing pillow.

pipenv install pillow==6.2.1

Recommended Posts

The latest version of Pillow 7.0.0 will kill the pytorch transform.
Use the latest version of PyCharm on Ubuntu
Install the latest version of CMake on Ubuntu 18.04.4 LTS
Align the version of chromedriver_binary
Put the latest version of Python on linux (Debian) on Chromebook
Install the latest version of Git on your Linux server
Test the version of the argparse module
Raise the version of pyenv itself
pyenv-change the python version of virtualenv
Change the Python version of Homebrew
Properties of the discrete Fourier transform
Install the latest version of Apache httpd 2.4 from source on Cent OS 8
About the virtual environment of python version 3.7
[Python] Try pydash of the Python version of lodash
Migemo version of the: find command,: mfind
It seems that the version of pyflakes is not the latest when flake8 is installed
The story of making the Mel Icon Generator version2
The value of pyTorch torch.var () is not distributed
A note about the python version of python virtualenv
Try the free version of Progate [Python I]
Get the latest Linux kernel version with Arch Linux
[Implementation explanation] How to use the Japanese version of BERT in Google Colaboratory (PyTorch)