About the PIL Error -- IOError: decoder zip not available
I am getting the:
IOError: decoder zip not available
when I try to draw an image and save to a jpeg in PIL. Any thoughts on how to resolve this? PIL has worked fine for me in the past, when it comes to viewing/uploading images.
sudo pip uninstall PIL
sudo pip install pillow
^^ fixed it for me.
Pillow is a fork of PIL that is compatible with pip/setuptools and gets a little better maintenance. I haven't seen any API differences yet.
Edit: There is one notable API difference. PIL exposes Image as a top-level namespace, so you can
import Image # in PIL only
but
from PIL import Image # in pillow or PIL
- Thanks, Leopd!
The more detail installation PIL with zlib library in Ubuntu 64 bit :
http://obroll.com/install-python-pil-python-image-library-on-ubuntu-11-10-oneiric/
For the lazy (credits to @meawoppl for the apt-get
):
$ sudo apt-get install libjpeg-dev zlib1g-dev
I encountered this problem on a 64bit ubuntu 13.04 desktop version and here is how I resolved it.
try to reinstall PIL, and pay attention to the output info after you reinstalled:
---------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.7
platform linux2 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
*** ZLIB (PNG/ZIP) support not available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------
notice that there is a line :*** ZLIB (PNG/ZIP) support not available
,
which means PIL have been built without ZLIB support, and I fixed it by doing this:
first you should have these packages install: libjpeg-dev libfreetype6-dev zlib1g-dev
sudo apt-get install python-dev libjpeg-dev libfreetype6-dev zlib1g-dev
# create these links, if already exists, remove it and re-link it
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
# reinstall PIL
pip uninstall PIL
pip install PIL
This time, there should be a line --- ZLIB (PNG/ZIP) support available
in the output.
Reference: http://jj.isgeek.net/2011/09/install-pil-with-jpeg-support-on-ubuntu-oneiric-64bits/