Mar 18, 2014

[SOLVED] OpenERP 7 IOError: decoder zip not available

IOError: decoder zip not available

its an error while you use PIL or Pillow with python-imaging together. On my case : with this environment :

Openerp 7
Ubuntu 13.10 x64

i've got an error as below : 

SOLVED IOError: decoder zip not available

then i test on console, its seem running

>>> from PIL import Image>>> 

but, still error while installing some modules. 

well, the solution is : 

1. remove python-imaging

sudo apt-get remove python-imaging

2. find your libz.so 

find . -iname libz.so 

3. create link (its depend on your libz.so)

sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

4. re-install PIL

sudo pip uninstall PIL
sudo pip install PIL

then you will see the last result is : 

    --------------------------------------------------------------------
    PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.7.5+ (default, Sep 19 2013, 13:48:49)
                  [GCC 4.8.1]
    --------------------------------------------------------------------
    *** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- FREETYPE2 support available
    *** LITTLECMS support not available
    --------------------------------------------------------------------
    To add a missing option, make sure you have the required
    library, and set the corresponding ROOT variable in the
    setup.py script.
    
    To check the build, run the selftest.py script.
    changing mode of build/scripts-2.7/pilconvert.py from 644 to 755
    changing mode of build/scripts-2.7/pilfile.py from 644 to 755
    changing mode of build/scripts-2.7/pilprint.py from 644 to 755
    changing mode of build/scripts-2.7/pilfont.py from 644 to 755
    changing mode of build/scripts-2.7/pildriver.py from 644 to 755
    
    changing mode of /usr/local/bin/pilconvert.py to 755
    changing mode of /usr/local/bin/pilfile.py to 755
    changing mode of /usr/local/bin/pilprint.py to 755
    changing mode of /usr/local/bin/pilfont.py to 755
    changing mode of /usr/local/bin/pildriver.py to 755
Successfully installed PIL
Cleaning up...

You can test with this simple script :

import urllib
from PIL import Image
import StringIO
file = StringIO.StringIO(urllib.urlopen('https://fbstatic-a.akamaihd.net/rsrc.php/v2/yi/r/OBaVg52wtTZ.png').read())
img = Image.open(file)
img = img.crop((0, 0, 400, 600))

if it running, then you are ready to work on.

.

IOError: decoder zip not available

its an error while you use PIL or Pillow with python-imaging together. On my case : with this environment :

Openerp 7
Ubuntu 13.10 x64

i've got an error as below : 

SOLVED IOError: decoder zip not available

then i test on console, its seem running

>>> from PIL import Image>>> 

but, still error while installing some modules. 

well, the solution is : 

1. remove python-imaging

sudo apt-get remove python-imaging

2. find your libz.so 

find . -iname libz.so 

3. create link (its depend on your libz.so)

sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

4. re-install PIL

sudo pip uninstall PIL
sudo pip install PIL

then you will see the last result is : 

    --------------------------------------------------------------------
    PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.7.5+ (default, Sep 19 2013, 13:48:49)
                  [GCC 4.8.1]
    --------------------------------------------------------------------
    *** TKINTER support not available (Tcl/Tk 8.5 libraries needed)
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- FREETYPE2 support available
    *** LITTLECMS support not available
    --------------------------------------------------------------------
    To add a missing option, make sure you have the required
    library, and set the corresponding ROOT variable in the
    setup.py script.
    
    To check the build, run the selftest.py script.
    changing mode of build/scripts-2.7/pilconvert.py from 644 to 755
    changing mode of build/scripts-2.7/pilfile.py from 644 to 755
    changing mode of build/scripts-2.7/pilprint.py from 644 to 755
    changing mode of build/scripts-2.7/pilfont.py from 644 to 755
    changing mode of build/scripts-2.7/pildriver.py from 644 to 755
    
    changing mode of /usr/local/bin/pilconvert.py to 755
    changing mode of /usr/local/bin/pilfile.py to 755
    changing mode of /usr/local/bin/pilprint.py to 755
    changing mode of /usr/local/bin/pilfont.py to 755
    changing mode of /usr/local/bin/pildriver.py to 755
Successfully installed PIL
Cleaning up...

You can test with this simple script :

import urllib
from PIL import Image
import StringIO
file = StringIO.StringIO(urllib.urlopen('https://fbstatic-a.akamaihd.net/rsrc.php/v2/yi/r/OBaVg52wtTZ.png').read())
img = Image.open(file)
img = img.crop((0, 0, 400, 600))

if it running, then you are ready to work on.

3 comments:

  1. thank for your good article but
    when i appy your second steps then
    2. find your libz.so
    find . -iname libz.so
    this kind of file doesn't find to my ubnutu 12.10 os then what to do this ..

    ReplyDelete

  2. that's just to ensure your libz location.

    you can change with :

    find /usr/lib/ -iname libz.so

    once you find it, just make link

    ReplyDelete