Thursday, October 30, 2008

strange "decoder jpeg not available"

well its obious what is wrong. pil was not compiled with jpeg support.

i'm currently setting up plone buildout on some centos box (for gentooista - like me - this is like having only one hand to type). i created virtual environment with --no-site-packages as usual. that means i need to install pil manualy.

?> wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
?> tar zxvf Imaging-1.1.6.tar.gz
?> cd Imaging-1.1.6
?> python setup.py install

the i've looked at build summary
--------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version 1.1.6
platform linux2 2.4.3 (#1, May 24 2008, 13:57:05)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available
--------------------------------------------------------------------


well next steps were obvious. i need to install libjpeg, zlib and freetype2, and then reinstall pil.

?> yum install libjpeg-devel zlib-devel freetype-devel
?> python setup.py install

and build summary is now
--------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version 1.1.6
platform linux2 2.4.3 (#1, May 24 2008, 13:57:05)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--------------------------------------------------------------------


so i installed it right? WRONG!! if you test you plone instance you'll see that you can not upload image. even deleting pil from site-packages and reistalling didnt helped. problem is that you need to have fresh unpacked (untouched) version of pil when you install it.

?> cd ..
?> rm Imaging-1.1.6/* -R && rmdir Imaging-1.1.6
?> tar zxvf Imaging-1.1.6.tar.gz
?> cd Imaging-1.1.6
?> python setup.py install


i think i saw some guy/girl asking ppl on #plone why there is no pil support even if build summary shows that there is. well i think this was the case or at least this save my day.

5 comments:

danfairs said...

Hey Rok - I normally pop this into my buildout.cfg:

[PIL]
# Build egg with Chris McDonough's custom packaging of setuptools-compatibile PIL
# http://article.gmane.org/gmane.comp.web.zope.devel/13999
# It gets installed in develop-eggs
recipe = zc.recipe.egg:custom
egg = PIL==1.1.6
find-links = http://dist.repoze.org/PIL-1.1.6.tar.gz
index = http://example.com/ignore/me

[Install-PIL]
recipe = zc.recipe.egg
eggs = PIL

Then just pop those into your parts section and you're good to go.

danfairs said...

Of course - that assumes your deps such as zlib and so on are already installed :)

Rok Garbas said...

tnx, does this also work when you:
1. run buildout when zlib is not installed
2. then install zlib
3. re-run buildout

this was the above case, but i guess zc.recipe.egg:custom untars pil every time

Invertir en oro said...

thanks for this infor, i would like to read more about this topic.

Anya said...

THANK YOU!! Worked perfectly for me after spending the better half of a weekend trying to figure out what was going wrong!