Pillow just released 7.0.0. This breaks torchvision.transforms as the import fails:
Traceback (most recent call last):
File "examples/mnist.py", line 5, in <module>
from torchvision.transforms import (
File "/home/felix/.local/share/virtualenvs/repro-Cd9xy9KO/lib/python3.6/site-packages/torchvision/__init__.py", line 4, in <module>
from torchvision import datasets
File "/home/felix/.local/share/virtualenvs/repro-Cd9xy9KO/lib/python3.6/site-packages/torchvision/datasets/__init__.py", line 9, in <module>
from .fakedata import FakeData
File "/home/felix/.local/share/virtualenvs/repro-Cd9xy9KO/lib/python3.6/site-packages/torchvision/datasets/fakedata.py", line 3, in <module>
from .. import transforms
File "/home/felix/.local/share/virtualenvs/repro-Cd9xy9KO/lib/python3.6/site-packages/torchvision/transforms/__init__.py", line 1, in <module>
from .transforms import *
File "/home/felix/.local/share/virtualenvs/repro-Cd9xy9KO/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 17, in <module>
from . import functional as F
File "/home/felix/.local/share/virtualenvs/repro-Cd9xy9KO/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'
https://github.com/python-pillow/Pillow/releases
run
from torchvision.transforms import Compose
torch==1.3.1
torchvision==0.4.2
torchvision==7.0.0
I pinned pillow to version 6.2.2. After this the import works again
I can confirm this issue when installing https://download.pytorch.org/whl/cpu/torchvision-0.4.2%2Bcpu-cp36-cp36m-linux_x86_64.whl
I still get version 7.0.0 when I install using the following command
pip3 install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html
or even using the following command
pip3 install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html
It seems like it was fixed here a few months ago: https://github.com/pytorch/vision/commit/b8ef5322b5aea611a6aca2c876578d012b9a890a
But there hasn't been a release that includes it.
Duplicate of https://github.com/pytorch/vision/issues/1712:
We will be releasing a new version of PyTorch and torchvision early next week, so this should be soon fixed.
As @hugovk mentioned in https://github.com/pytorch/vision/issues/1714#issuecomment-570536493, we will be releasing a new version of torchvision early next week, so I believe this can be closed.
Thanks for the reports!
@fmassa thank you for being so responsive!
Thank you!
Most helpful comment
As @hugovk mentioned in https://github.com/pytorch/vision/issues/1714#issuecomment-570536493, we will be releasing a new version of torchvision early next week, so I believe this can be closed.
Thanks for the reports!