IOError: decoder zip not available

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

IOError: decoder zip not available

Johnson, Adam
Hello!

I am trying to run an image processing script on a new server under CentOS 5.4. I have compiled and installed PIL 1.1.7 to run with Python 2.7.1. The compile went fine. All libraries (except TKInter) were found. All 57 tests were passed by the test script.

When I try to run my script, however, I get the following error:

IOError: decoder zip not available

I presume that this either has to do with zlib or libjpeg but, as I said, these libraries are installed and have been successfully used by other apps on the server such as php 5.3.3 and ImageMagick.

Can someone help me find out what is not working and how to fix it?

I have confirmed that sys.path is looking in the right directories for the libraries. I have also confirmed, by enabling verbose mode and importing the Image module in IDLE.

Everything seems to look right but, still, it cannot find decoder zip. Here is the output from the script I am using:


The python sys path is:
['/usr/local/mcutil/haven/minecraft-overviewer', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/encodings', '/usr/local/mcutil/haven/minecraft-overviewer', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages/PIL', '/usr/local/lib/python2.7/site-packages/numpy']
Traceback (most recent call last):
  File "/usr/local/mcutil/haven/minecraft-overviewer/gmap.py", line 40, in <module>
    import world
  File "/usr/local/mcutil/haven/minecraft-overviewer/world.py", line 28, in <module>
    import chunk
  File "/usr/local/mcutil/haven/minecraft-overviewer/chunk.py", line 25, in <module>
    import textures
  File "/usr/local/mcutil/haven/minecraft-overviewer/textures.py", line 116, in <module>
    terrain_images = _split_terrain(_get_terrain_image())
  File "/usr/local/mcutil/haven/minecraft-overviewer/textures.py", line 110, in _split_terrain
    Image.BICUBIC)
  File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 1615, in transform
    im.__transformer((0, 0)+size, self, method, data, resample, fill)
  File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 1658, in __transformer
    image.load()
  File "/usr/local/lib/python2.7/site-packages/PIL/ImageFile.py", line 189, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 385, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder zip not available


I have re-installed the zlib and zlib-devel packages via yum with no effect.
I have rebuilt PIL several times and received positive results from the build process but no change in behavior. (Here is a copy of the output of setup.py:


[root@mc2 Imaging-1.1.7]# python setup.py install
running install
running build
running build_py
running build_ext
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.1 (r271:86832, Dec  9 2010, 10:13:10)
              [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
--- LITTLECMS support 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.
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/local/bin/pildriver.py to 755
changing mode of /usr/local/bin/pilfile.py to 755
changing mode of /usr/local/bin/pilconvert.py to 755
changing mode of /usr/local/bin/pilfont.py to 755
changing mode of /usr/local/bin/pilprint.py to 755
running install_egg_info
Removing /usr/local/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
Writing /usr/local/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
creating /usr/local/lib/python2.7/site-packages/PIL.pth


I have scoured dozens of threads relating to the same problem. Most of them yeilded terse, dummy answers like not having the devel packages installed for the dependencies. This is obviously not the case here.


[root@mc2 Imaging-1.1.7]# yum list installed |grep zlib
zlib.x86_64                               1.2.3-3                      installed
zlib-devel.x86_64                         1.2.3-3                      installed
[root@mc2 Imaging-1.1.7]# yum list installed |grep jpeg
libjpeg.x86_64                            6b-37                        installed
libjpeg-devel.x86_64                      6b-37                        installed
[root@mc2 Imaging-1.1.7]# yum list installed |grep png
libpng.x86_64                             2:1.2.10-7.1.el5_5.3         installed
libpng-devel.x86_64                       2:1.2.10-7.1.el5_5.3         installed
[root@mc2 Imaging-1.1.7]# yum list installed |grep tiff
libtiff.x86_64                            3.8.2-7.el5_5.5              installed
libtiff-devel.x86_64                      3.8.2-7.el5_5.5              installed
[root@mc2 Imaging-1.1.7]# yum list installed |grep freetype
freetype.x86_64                           2.2.1-28.el5_5.1             installed
freetype-devel.x86_64                     2.2.1-28.el5_5.1             installed
[root@mc2 Imaging-1.1.7]# yum list installed |grep lcms
lcms.x86_64                               1.18-0.1.beta1.el5_3.2       installed
lcms-devel.x86_64                         1.18-0.1.beta1.el5_3.2       installed


I also tried digging through the archives of this mailing list but I cannot find a search tool. I went back several weeks, chronologically and did not find any mention of this error message. My apologies if it is here somewhere and I did not know how to find it.

Any help with where to look, how to troubleshoot, or even an answer would be greatly appreciated.

Thanks in advance!
Hitting his head against the wall,
Adam  :)

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: IOError: decoder zip not available

Fredrik Lundh
The setup output looks fine, so my guess is that your script isn't
picking up the same build as the one you get when you run the test
script.  Running the following command in your PIL build directory and
your script directory will tell you what files Python are using:

python -c "import _imaging; print _imaging.__file__"

</F>

2011/1/7 Johnson, Adam <[hidden email]>:

> Hello!
>
> I am trying to run an image processing script on a new server under CentOS
> 5.4. I have compiled and installed PIL 1.1.7 to run with Python 2.7.1. The
> compile went fine. All libraries (except TKInter) were found. All 57 tests
> were passed by the test script.
>
> When I try to run my script, however, I get the following error:
>
> IOError: decoder zip not available
>
> I presume that this either has to do with zlib or libjpeg but, as I said,
> these libraries are installed and have been successfully used by other apps
> on the server such as php 5.3.3 and ImageMagick.
>
> Can someone help me find out what is not working and how to fix it?
>
> I have confirmed that sys.path is looking in the right directories for the
> libraries. I have also confirmed, by enabling verbose mode and importing the
> Image module in IDLE.
>
> Everything seems to look right but, still, it cannot find decoder zip. Here
> is the output from the script I am using:
>
>
> The python sys path is:
> ['/usr/local/mcutil/haven/minecraft-overviewer', '/usr/local/lib/python2.7',
> '/usr/local/lib/python2.7/site-packages',
> '/usr/local/lib/python2.7/encodings',
> '/usr/local/mcutil/haven/minecraft-overviewer',
> '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7/plat-linux2',
> '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old',
> '/usr/local/lib/python2.7/lib-dynload',
> '/usr/local/lib/python2.7/site-packages/PIL',
> '/usr/local/lib/python2.7/site-packages/numpy']
> Traceback (most recent call last):
>   File "/usr/local/mcutil/haven/minecraft-overviewer/gmap.py", line 40, in
> <module>
>     import world
>   File "/usr/local/mcutil/haven/minecraft-overviewer/world.py", line 28, in
> <module>
>     import chunk
>   File "/usr/local/mcutil/haven/minecraft-overviewer/chunk.py", line 25, in
> <module>
>     import textures
>   File "/usr/local/mcutil/haven/minecraft-overviewer/textures.py", line 116,
> in <module>
>     terrain_images = _split_terrain(_get_terrain_image())
>   File "/usr/local/mcutil/haven/minecraft-overviewer/textures.py", line 110,
> in _split_terrain
>     Image.BICUBIC)
>   File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 1615, in
> transform
>     im.__transformer((0, 0)+size, self, method, data, resample, fill)
>   File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 1658, in
> __transformer
>     image.load()
>   File "/usr/local/lib/python2.7/site-packages/PIL/ImageFile.py", line 189,
> in load
>     d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
>   File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 385, in
> _getdecoder
>     raise IOError("decoder %s not available" % decoder_name)
> IOError: decoder zip not available
>
>
> I have re-installed the zlib and zlib-devel packages via yum with no effect.
> I have rebuilt PIL several times and received positive results from the
> build process but no change in behavior. (Here is a copy of the output of
> setup.py:
>
>
> [root@mc2 Imaging-1.1.7]# python setup.py install
> running install
> running build
> running build_py
> running build_ext
> --------------------------------------------------------------------
> PIL 1.1.7 SETUP SUMMARY
> --------------------------------------------------------------------
> version       1.1.7
> platform      linux2 2.7.1 (r271:86832, Dec  9 2010, 10:13:10)
>               [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)]
> --------------------------------------------------------------------
> *** TKINTER support not available
> --- JPEG support available
> --- ZLIB (PNG/ZIP) support available
> --- FREETYPE2 support available
> --- LITTLECMS support 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.
> running build_scripts
> running install_lib
> running install_scripts
> changing mode of /usr/local/bin/pildriver.py to 755
> changing mode of /usr/local/bin/pilfile.py to 755
> changing mode of /usr/local/bin/pilconvert.py to 755
> changing mode of /usr/local/bin/pilfont.py to 755
> changing mode of /usr/local/bin/pilprint.py to 755
> running install_egg_info
> Removing /usr/local/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
> Writing /usr/local/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
> creating /usr/local/lib/python2.7/site-packages/PIL.pth
>
>
> I have scoured dozens of threads relating to the same problem. Most of them
> yeilded terse, dummy answers like not having the devel packages installed
> for the dependencies. This is obviously not the case here.
>
>
> [root@mc2 Imaging-1.1.7]# yum list installed |grep zlib
> zlib.x86_64                               1.2.3-3
> installed
> zlib-devel.x86_64                         1.2.3-3
> installed
> [root@mc2 Imaging-1.1.7]# yum list installed |grep jpeg
> libjpeg.x86_64                            6b-37
> installed
> libjpeg-devel.x86_64                      6b-37
> installed
> [root@mc2 Imaging-1.1.7]# yum list installed |grep png
> libpng.x86_64                             2:1.2.10-7.1.el5_5.3
> installed
> libpng-devel.x86_64                       2:1.2.10-7.1.el5_5.3
> installed
> [root@mc2 Imaging-1.1.7]# yum list installed |grep tiff
> libtiff.x86_64                            3.8.2-7.el5_5.5
> installed
> libtiff-devel.x86_64                      3.8.2-7.el5_5.5
> installed
> [root@mc2 Imaging-1.1.7]# yum list installed |grep freetype
> freetype.x86_64                           2.2.1-28.el5_5.1
> installed
> freetype-devel.x86_64                     2.2.1-28.el5_5.1
> installed
> [root@mc2 Imaging-1.1.7]# yum list installed |grep lcms
> lcms.x86_64                               1.18-0.1.beta1.el5_3.2
> installed
> lcms-devel.x86_64                         1.18-0.1.beta1.el5_3.2
> installed
>
>
> I also tried digging through the archives of this mailing list but I cannot
> find a search tool. I went back several weeks, chronologically and did not
> find any mention of this error message. My apologies if it is here somewhere
> and I did not know how to find it.
>
> Any help with where to look, how to troubleshoot, or even an answer would be
> greatly appreciated.
>
> Thanks in advance!
> Hitting his head against the wall,
> Adam  :)
>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig
>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: IOError: decoder zip not available

Johnson, Adam
  Thank you for the troubleshooting technique! I am still getting
oriented with Python. Sadly, this did not reveal anything telling. I ran
this command as root and as the user who will be running it. I ran from
the Imaging build directory, from the directory in which the script is
located and from the user's home directory. All came back with the same
path to the library file:

/usr/local/lib/python2.7/site-packages/PIL/_imaging.so

This is what I would expect when things are working correctly.

Is there anything else I can check?

Thanks for your help.
Adam



On 1/7/2011 3:33 PM, Fredrik Lundh wrote:
> python -c "import _imaging; print _imaging.__file__"
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: IOError: decoder zip not available

Fredrik Lundh
Oh, I just noticed that your mail included the "SETUP SUMMARY" but not
the selftest summary.  Did you install the missing libraries after an
initial failed build?  It could be that distutils didn't rebuild the
necessary files for you...

For a quick sanity check, in your build directory, do:

$ ls -l build/*/libImaging/*.o

and check that the ZipEncode and ZipDecode object files aren't
suspiciously tiny compared to the rest of the modules (they're still
built if zip support is disabled, but are mostly empty in that case).

If this seems to be the case, or if you just want to be sure, nuke the
build directory and run setup again.  You can use build_ext -i to
build just the extensions in the current directory:

$ rm -rf build
$ python2.7 setup.py build_ext -i
$ python2.7
>>> import _imaging
>>> dir(_imaging)
... look for zip functions ... or do:
>>> [(k, v) for k, v in vars(_imaging).items() if k[0] == 'z']
[('zip_decoder', <built-in function zip_decoder>), ('zlib_version',
'1.2.3.3'), ('zip_encoder', <built-in function zip_encoder>)]

If your result matches the sample output above, run setup.py install
and make sure that the _imaging.so module installed under
site-packages matches the one that was built locally.

</F>

2011/1/8 Adam M. Johnson <[hidden email]>:

>  Thank you for the troubleshooting technique! I am still getting oriented
> with Python. Sadly, this did not reveal anything telling. I ran this command
> as root and as the user who will be running it. I ran from the Imaging build
> directory, from the directory in which the script is located and from the
> user's home directory. All came back with the same path to the library file:
>
> /usr/local/lib/python2.7/site-packages/PIL/_imaging.so
>
> This is what I would expect when things are working correctly.
>
> Is there anything else I can check?
>
> Thanks for your help.
> Adam
>
>
>
> On 1/7/2011 3:33 PM, Fredrik Lundh wrote:
>>
>> python -c "import _imaging; print _imaging.__file__"
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: IOError: decoder zip not available

Johnson, Adam
  Ah- I think we are getting somewhere...

The ZipEncode and ZipDecode files were not in the build branch at all. I
rmvd the build directory and rebuilt again according to your
instructions. I got the all-is-well summary but still no
ZipEncode/ZipDecode files created in the build directory. In fact, the
build directory did not return. I then ran selftest.py and all 57 tests
passed!

The build and the selftest ran suspiciously quick, though:

[root@mc2 Imaging-1.1.7]# ls -al build
ls: build: No such file or directory
[root@mc2 Imaging-1.1.7]# python2.7 setup.py build_ext -i
running build_ext
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.1 (r271:86832, Dec  9 2010, 10:13:10)
               [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
--- LITTLECMS support 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.
[root@mc2 Imaging-1.1.7]# python2.7 selftest.py
--------------------------------------------------------------------
PIL 1.1.7 TEST SUMMARY
--------------------------------------------------------------------
Python modules loaded from ./PIL
Binary modules loaded from ./PIL
--------------------------------------------------------------------
--- PIL CORE support ok
*** TKINTER support not installed
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--- LITTLECMS support ok
--------------------------------------------------------------------
Running selftest:
--- 57 tests passed.


Also, it does look like the built imaging library is not the same as the
one installed in the PIL branch under ...python2.7/site-packages.

Do you think if I:
rm -rf  /usr/local/lib/python2.7/site-packages/PIL*

..and then restore the original source package and start the build from
scratch, it will clear things up? (Actually, I am pretty sure I have
already done this but who knows what might have transpired in-between
last time.)

Thanks!
Adam




On 1/7/2011 8:54 PM, Fredrik Lundh wrote:

> Oh, I just noticed that your mail included the "SETUP SUMMARY" but not
> the selftest summary.  Did you install the missing libraries after an
> initial failed build?  It could be that distutils didn't rebuild the
> necessary files for you...
>
> For a quick sanity check, in your build directory, do:
>
> $ ls -l build/*/libImaging/*.o
>
> and check that the ZipEncode and ZipDecode object files aren't
> suspiciously tiny compared to the rest of the modules (they're still
> built if zip support is disabled, but are mostly empty in that case).
>
> If this seems to be the case, or if you just want to be sure, nuke the
> build directory and run setup again.  You can use build_ext -i to
> build just the extensions in the current directory:
>
> $ rm -rf build
> $ python2.7 setup.py build_ext -i
> $ python2.7
>>>> import _imaging
>>>> dir(_imaging)
> ... look for zip functions ... or do:
>>>> [(k, v) for k, v in vars(_imaging).items() if k[0] == 'z']
> [('zip_decoder',<built-in function zip_decoder>), ('zlib_version',
> '1.2.3.3'), ('zip_encoder',<built-in function zip_encoder>)]
>
> If your result matches the sample output above, run setup.py install
> and make sure that the _imaging.so module installed under
> site-packages matches the one that was built locally.
>
> </F>
>
> 2011/1/8 Adam M. Johnson<[hidden email]>:
>>   Thank you for the troubleshooting technique! I am still getting oriented
>> with Python. Sadly, this did not reveal anything telling. I ran this command
>> as root and as the user who will be running it. I ran from the Imaging build
>> directory, from the directory in which the script is located and from the
>> user's home directory. All came back with the same path to the library file:
>>
>> /usr/local/lib/python2.7/site-packages/PIL/_imaging.so
>>
>> This is what I would expect when things are working correctly.
>>
>> Is there anything else I can check?
>>
>> Thanks for your help.
>> Adam
>>
>>
>>
>> On 1/7/2011 3:33 PM, Fredrik Lundh wrote:
>>> python -c "import _imaging; print _imaging.__file__"
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: IOError: decoder zip not available

Johnson, Adam
In reply to this post by Fredrik Lundh
Alright, it looks like it is working now. Here is what I did to rebuild
and re-install PIL from scratch:

# rm -rf /usr/local/lib/python2.7/site-packages/PIL*
# rm -rf /src/Imaging-1.1.7
# cd /src
# tar -xvzf Imaging-1.1.7.tar.gz
# cd Imaging-1.1.7
# python2.7 setup.py build_ext -i
# python2.7 selftest.py
# python2.7
 >>> import _imaging
 >>> [(k, v) for k, v in vars(_imaging).items() if k[0] == 'z']    
#Confirmed that the zip decoder libs were there
# python2.7 setup.py install

In trying to retrace my steps to figure out where I went wrong, I think
I used the "simple" install method listed at the top of the README (0.
If you're in a hurry...) first. All the supporting libraries were in
place in their standard locations so I figured I was safe for the simple
install. Note to self...)  ;)

Anyway, i remember that this failed to find 3/5 libraries. It appears
that the build process does not check /usr/lib64 by default (which is
one of the default locations for libraries on a Linux x64 system. So, I
updated setup.py with the necessary paths to the libs.

I believe I then tried a "setup.py clean" command to reset the build
directories... Something along those lines. In any case, it appears I
did not get the original failed install out of the system when I thought
I had and that is what was tripping me up all along.

Thank you very much for your help! My script is chugging away now.  :)
Enjoy the weekend!
-Adam




On 1/7/2011 8:54 PM, Fredrik Lundh wrote:

> Oh, I just noticed that your mail included the "SETUP SUMMARY" but not
> the selftest summary.  Did you install the missing libraries after an
> initial failed build?  It could be that distutils didn't rebuild the
> necessary files for you...
>
> For a quick sanity check, in your build directory, do:
>
> $ ls -l build/*/libImaging/*.o
>
> and check that the ZipEncode and ZipDecode object files aren't
> suspiciously tiny compared to the rest of the modules (they're still
> built if zip support is disabled, but are mostly empty in that case).
>
> If this seems to be the case, or if you just want to be sure, nuke the
> build directory and run setup again.  You can use build_ext -i to
> build just the extensions in the current directory:
>
> $ rm -rf build
> $ python2.7 setup.py build_ext -i
> $ python2.7
>>>> import _imaging
>>>> dir(_imaging)
> ... look for zip functions ... or do:
>>>> [(k, v) for k, v in vars(_imaging).items() if k[0] == 'z']
> [('zip_decoder',<built-in function zip_decoder>), ('zlib_version',
> '1.2.3.3'), ('zip_encoder',<built-in function zip_encoder>)]
>
> If your result matches the sample output above, run setup.py install
> and make sure that the _imaging.so module installed under
> site-packages matches the one that was built locally.
>
> </F>
>
> 2011/1/8 Adam M. Johnson<[hidden email]>:
>>   Thank you for the troubleshooting technique! I am still getting oriented
>> with Python. Sadly, this did not reveal anything telling. I ran this command
>> as root and as the user who will be running it. I ran from the Imaging build
>> directory, from the directory in which the script is located and from the
>> user's home directory. All came back with the same path to the library file:
>>
>> /usr/local/lib/python2.7/site-packages/PIL/_imaging.so
>>
>> This is what I would expect when things are working correctly.
>>
>> Is there anything else I can check?
>>
>> Thanks for your help.
>> Adam
>>
>>
>>
>> On 1/7/2011 3:33 PM, Fredrik Lundh wrote:
>>> python -c "import _imaging; print _imaging.__file__"
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig