stas
(Stas Bekman)
May 8, 2018, 7:36am
21
In my case (running on Google Colab) the latter didn’t work as is, I had to add:
from PIL import Image
and the complete thing (added after all the other setup has been completed)
# workaround
from PIL import Image
def register_extension(id, extension): Image.EXTENSION[extension.lower()] = id.upper()
Image.register_extension = register_extension
def register_extensions(id, extensions):
for extension in extensions: register_extension(id, extension)
Image.register_extensions = register_extensions
4 Likes
It’s good workaround. Works for me.
mantou
(mantou)
September 6, 2018, 12:30am
24
not sure if anything changed on colab recently, but the same code I was using 1 or 2 weeks ago was working fine but recently running into the same issue. however, without any change or code, just simply restart the runtime, the problem resolved. Kind of feel it is caused by some library update/sync issue because I usually install PIL right before I ran my code.
dheid
(David)
September 6, 2018, 12:57am
25
Same, having problems in Colab and previous solutions do not appear to be working.
pyaf
(Rishabh Agrahari)
October 5, 2018, 2:18pm
26
None of the above solutions worked for me, I found the way out by doing this:
!rm -rf /usr/local/lib/python3.6/dist-packages/PIL/
!rm -rf /usr/local/lib/python3.6/dist-packages/Pillow-4.0.0.dist-info/
restart the runtime after this, reinstall pillow with !pip install pillow
gshashank84
(Shashank Gupta)
October 18, 2018, 1:12pm
27
The Pillow version of 4.1.1 is the right package for running the model
pip install pillow==4.1.1
I have checked with examples also, all the models are working fine
dallarosa
(Francisco Soares)
November 27, 2018, 5:53am
28
Installing version 4.0.0 worked like a charm for me. just make you do this as the last step so that other libraries can’t upgrade this again
1 Like
irzelindo
(Irzelindo)
November 29, 2018, 10:53pm
29
This solution also worked for me.
danielbruno301
(Daniel Bruno Bezerra Costa)
December 17, 2018, 5:51pm
31
This solution worked very well for me on Google Colab! Thanks a lot!
well that solved the issue with some warnings and some errors as well on colab.
But thanks for sharing
zsweedyk
(Elizabeth Sweedyk)
April 2, 2019, 4:17am
34
I’m trying to deploy on EC2. None of these solutions have worked. Any other suggestions?
This solution helped me out in 2021