Skip to content
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

pillow 7.0.0 has removed PILLOW_VERSION #1718

Closed
Gijs-Koot opened this issue Jan 3, 2020 · 7 comments
Closed

pillow 7.0.0 has removed PILLOW_VERSION #1718

Gijs-Koot opened this issue Jan 3, 2020 · 7 comments

Comments

@Gijs-Koot
Copy link

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.

@fmassa
Copy link
Member

fmassa commented Jan 3, 2020

Thanks for opening the issue!

This is a duplicate of #1712, and has been fixed in torchvision master already. We will be releasing a new version of torchvision early next week, which contains the fix.

@fmassa fmassa closed this as completed Jan 3, 2020
aadcock pushed a commit to aadcock/ClassyVision-2 that referenced this issue Jan 6, 2020
Summary:
We are hitting an issue where torchvision current release is broken with the current version of PIL. So in OSS land, users with 0.4.2 who update their PIL version will have Classy Vision break if torchvision is included in a file.

Torchvision will fix this next week, but then we will need our requirements to be updated. Should we use >= for our requirements rather than pinning to a specific torchvision version rather than updating with each torchvision release?

RFC since the original diff (D18450381) undid the ">=" for pytorch and mentions pinning to 0.4.2, but the reasoning expressed in the diff seems to indicate that the goal was to get off torchvision nightly builds.

For more details on PILLOW issue, see https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#700-unreleased and pytorch/vision#1712 and pytorch/vision#1718

Reviewed By: vreis

Differential Revision: D19279771

fbshipit-source-id: ff9c923e83da009fe4d9165cc2592177ae33405e
facebook-github-bot pushed a commit to facebookresearch/ClassyVision that referenced this issue Jan 6, 2020
Summary:
Pull Request resolved: fairinternal/ClassyVision#57

Pull Request resolved: #333

We are hitting an issue where torchvision current release is broken with the current version of PIL. So in OSS land, users with 0.4.2 who update their PIL version will have Classy Vision break if torchvision is included in a file.

Torchvision will fix this next week, but then we will need our requirements to be updated. Should we use >= for our requirements rather than pinning to a specific torchvision version rather than updating with each torchvision release?

RFC since the original diff (D18450381) undid the ">=" for pytorch and mentions pinning to 0.4.2, but the reasoning expressed in the diff seems to indicate that the goal was to get off torchvision nightly builds.

For more details on PILLOW issue, see https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#700-unreleased and pytorch/vision#1712 and pytorch/vision#1718

Reviewed By: vreis

Differential Revision: D19279771

fbshipit-source-id: 880f81ca4b00dd7f541b7e2d60502b9839265422
@brando90
Copy link

what is the minimum version of pytorch and torchvision for this error to stop?

@brando90
Copy link

#1712

What is the solution for this issue?

I have pytorch 1.4.0 and it seems to still be a problem:

(automl) brandBrandoParetoopareto~/automl-meta-learning/automl/experiments $ conda list
# packages in environment at /Users/brandBrandoParetoopareto/anaconda3/envs/automl:
#
# Name                    Version                   Build  Channel
absl-py                   0.9.0                    py37_0  
asn1crypto                1.3.0                    py37_0  
astroid                   2.3.3                    py37_0  
beautifulsoup4            4.8.2                    py37_0  
blas                      1.0                         mkl  
bzip2                     1.0.8                h1de35cc_0  
c-ares                    1.15.0            h1de35cc_1001  
ca-certificates           2020.1.1                      0  
certifi                   2019.11.28               py37_1  
cffi                      1.14.0           py37hb5b8e2f_0  
chardet                   3.0.4                 py37_1003  
conda                     4.8.3                    py37_0  
conda-build               3.18.11                  py37_0  
conda-package-handling    1.6.0            py37h1de35cc_0  
cryptography              2.8              py37ha12b0ac_0  
filelock                  3.0.12                     py_0  
freetype                  2.9.1                hb4e5f40_0  
glob2                     0.7                        py_0  
grpcio                    1.16.1           py37h044775b_1  
idna                      2.9                        py_1  
intel-openmp              2019.4                      233  
isort                     4.3.21                   py37_0  
jinja2                    2.11.1                     py_0  
jpeg                      9b                   he5867d9_2  
lazy-object-proxy         1.4.3            py37h1de35cc_0  
libarchive                3.3.3                h786848e_5  
libcxx                    4.0.1                hcfea43d_1  
libcxxabi                 4.0.1                hcfea43d_1  
libedit                   3.1.20181209         hb402a30_0  
libffi                    3.2.1                h475c297_4  
libgfortran               3.0.1                h93005f0_2  
libiconv                  1.15                 hdd342a3_7  
liblief                   0.9.0                h2a1bed3_2  
libpng                    1.6.37               ha441bb4_0  
libprotobuf               3.11.4               hd9629dc_0  
libtiff                   4.1.0                hcb84e12_0  
libxml2                   2.9.9                hf6e021a_1  
lz4-c                     1.8.1.2              h1de35cc_0  
lzo                       2.10                 h362108e_2  
markdown                  3.1.1                    py37_0  
markupsafe                1.1.1            py37h1de35cc_0  
mccabe                    0.6.1                    py37_1  
mkl                       2019.4                      233  
mkl-service               2.3.0            py37hfbe908c_0  
mkl_fft                   1.0.15           py37h5e564d8_0  
mkl_random                1.1.0            py37ha771720_0  
ncurses                   6.2                  h0a44026_0  
ninja                     1.9.0            py37h04f5b5a_0  
numpy                     1.18.1           py37h7241aed_0  
numpy-base                1.18.1           py37h6575580_1  
olefile                   0.46                     py37_0  
openssl                   1.1.1e               h1de35cc_0  
pillow                    7.0.0            py37h4655f20_0  
pip                       20.0.2                   py37_1  
pkginfo                   1.5.0.1                  py37_0  
protobuf                  3.11.4           py37h0a44026_0  
psutil                    5.7.0            py37h1de35cc_0  
py-lief                   0.9.0            py37h1413db1_2  
pycosat                   0.6.3            py37h1de35cc_0  
pycparser                 2.20                       py_0  
pylint                    2.4.4                    py37_0  
pyopenssl                 19.1.0                   py37_0  
pysocks                   1.7.1                    py37_0  
python                    3.7.7           hc70fcce_0_cpython  
python-libarchive-c       2.8                     py37_13  
pytorch                   1.4.0                   py3.7_0    pytorch
pytz                      2019.3                     py_0  
pyyaml                    5.3.1            py37h1de35cc_0  
readline                  8.0                  h1de35cc_0  
requests                  2.23.0                   py37_0  
ripgrep                   11.0.2               he32d670_0  
ruamel_yaml               0.15.87          py37h1de35cc_0  
setuptools                46.1.1                   py37_0  
six                       1.14.0                   py37_0  
soupsieve                 2.0                        py_0  
sqlite                    3.31.1               ha441bb4_0  
tensorboard               2.0.0              pyhb38c66f_1  
tk                        8.6.8                ha441bb4_0  
torchvision               0.2.1                      py_2    soumith
tqdm                      4.43.0                     py_0  
urllib3                   1.25.8                   py37_0  
werkzeug                  1.0.0                      py_0  
wheel                     0.34.2                   py37_0  
wrapt                     1.12.1           py37h1de35cc_1  
xz                        5.2.4                h1de35cc_4  
yaml                      0.1.7                hc338f04_2  
zlib                      1.2.11               h1de35cc_3  
zstd                      1.3.7                h5bba6e5_0

@brando90
Copy link

seems this temp soln works:

conda install pillow=6.2.1 -y

@fmassa
Copy link
Member

fmassa commented Apr 6, 2020

This issue is fixed with PyTorch and TorchVision nightlies. A new stable release of both libraries will be released next week.

Note that the release 0.5.0 didn't contain the fix

@free-soellingeraj
Copy link

I am obtaining torchvision using the docker image nvcr.io/nvidia/pytorch:19.11-py3. Is there a docker image that incorporates the change above?

@fmassa
Copy link
Member

fmassa commented May 14, 2020

@free-soellingeraj I don't know. I don't think we provide docker images with our libraries.

cc @seemethere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants