-
Notifications
You must be signed in to change notification settings - Fork 7k
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
New Pillow version (7.0.0) breaks torchvision (ImportError: cannot import name 'PILLOW_VERSION' from 'PIL') #1712
Comments
Hi, Thanks for the report! We will be releasing a new version of PyTorch and torchvision early next week, so this should be soon fixed. As such, I'm closing the issue, but let me know if you have further questions. |
Is there a workaround until then? Is there a version that does not depend on pillow 7.0.0? |
Until the new torchvision release is out, the workaround is either to use the master version of torchvision (eg. |
@sachinparyani you can also install torchvision from a nightly, which also requires a pytorch from a nightly version, or wait until the next release next week |
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
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
Summary: Address pillow_version bug blocking builds: see pytorch/vision#1712 Reviewed By: ldworkin Differential Revision: D19312740 fbshipit-source-id: 062d720a652367921fcae6b2918092c604945f47
Summary: Pull Request resolved: #241 Address pillow_version bug blocking builds: see pytorch/vision#1712 Reviewed By: ldworkin Differential Revision: D19312740 fbshipit-source-id: 6bfcdc822d6d56d819becf749b59d5dc2a7998e0
UPDATE: |
From what I remember, I had to use the pip install method @mgbvox . For whatever reason, torchvision 0.5.0 wasn't available on conda when I tried and from what you seem to be saying, it still isn't. And be sure to specify the version of torchvision when you install via pip. Hope this helps. [Edited for clarity] [Edit 2: I see I am a bit late with my comment. Glad you figured it out!] |
what is the latest version of pytorch that does not break with this pillow error? |
I have a question. What is the solution to this issue? What is the minimum version of pytorch that doesn't break it? how do I solve this? I have pytorch 1.4.0 and it seems to still be a problem:
|
seems this temp soln works:
|
Additionally, using PyTorch and torchvision from a nightly version fixes this |
Can someone update
|
Same here |
@DSLituiev I think we don't distribute cc @soumith @seemethere for thoughts |
we dont distributed torchvision-cpu packges, but we do distributed Conda CPU-only torchvision packages. They are installable via a label: |
great job,thank you!! |
The latest release of torchvision (with the fix for PILLOW == 7) has been released |
Hi all, I upgraded to torchvision 0.5.0 and the pillow 7.0.0 issue is solved, but now I get this error
torch: 1.4.0 |
Hi all,I am also getting this error after installing torchvision 0.5.0 and the pillow 7.1.2. Thanks in Advance! |
Hi @pennarellor and @saipreethamsata Those are different issues, and I would recommend opening a new issue for those. |
Hi @pennarellor and @saipreethamsata I had the same error after resolving the Pillow version issue. Restarting the Jupyter notebook kernel resolved it. |
Temp patch until moving to torchvision 0.5. See pytorch/vision#1712 (comment)
This might be late, but for fellow travelers led to this by Google, a simpler workaround for this, instead of downgrading can be done by patching the torchvision/transforms/functional.py file. If you remove the PILLOW_VERSION import from the import and then replace PILLOW_VERSION with PIL.version in line 727, then it works without a downgrade. Official PIL docs recommends using version instead. |
I still need to use
Is this supposed to be fixed? I see this issue is closed. |
Temp patch until moving to torchvision 0.5. See pytorch/vision#1712 (comment)
Temp patch until moving to torchvision 0.5. See pytorch/vision#1712 (comment)
Hi, it looks like Pillow released version 7.0.0 so I can no longer import torchvision without getting this error:
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'
Pinning to Pillow 6.2.1 fixes the issue.
I see that you fixed this for a future torchvision release (#1501). Do you know when this will be released? If it will be awhile, could the version of Pillow be pinned to be less than 7.0.0 in the meantime?
Thanks.
Versions:
torch: 1.3.1
torchvision: 0.4.2
Pillow: 7.0.0
The text was updated successfully, but these errors were encountered: