python-pillow / Pillow

Python Imaging Library (Fork)
https://python-pillow.org
Other
12.3k stars 2.23k forks source link

Tip on Decoder JPEG not available (addition to docs ?) #1275

Closed rouxxx closed 9 years ago

rouxxx commented 9 years ago

Hi all,

This thread is about solving an issue. We all came across the "Decoder JPEG not available" error and many solutions can be found (libjpeg, etc...).

In my case, after numerous install/uninstall of Pillow and even more apt-get i was still stucked on this error.

It appears that pip cached the built setup in /root/.cache/pip/ (i was logged as root) so everytime i thought i was reinstalling Pillow, it just used the already compiled setup (without the necessary lib). I cleaned that directory and I was drowned by tears of joy as error was gone while my thumbnails appeared !

Thanks for Pillow, i can get back to normal life now... ;)

aclark4life commented 9 years ago

@rouxxx Great! Glad to hear, thanks. Yes we should add "clear cache" or something like it to the docs.

hwms commented 9 years ago
rm -rf ~/.cache/pip
tox -r 

worked for me at model_mommy

Thanks for that hint....had an equal sounding horror story several times when trying to get pillow to work ;P

jbarlow83 commented 9 years ago

I think Pillow's installation should abort with a fatal error if the JPEG and PNG libraries are not available, with platform specific instructions for the user to install the missing support libraries. Let's face it, if Pillow installs without these, it's broken.

Perhaps an override flag could be added for the 0.0001% of users who would consider an imaging manipulation library useful if it can't manipulate the two most common and important image formats.

aclark4life commented 9 years ago

@jbarlow83 Not a bad idea…

njamaleddine commented 9 years ago

@rouxxx I was having the same issue even after installing libjpeg on Ubuntu 14.04 x64. @katakumpo's solution rm -rf ~/.cache/pip worked well

wiredfool commented 9 years ago

@jbarlow83 Pillow 3.0 does not let you build without zlib(png) or libjpeg unless you explicitly ask for it.

pauloxnet commented 9 years ago

Can you add instructions to use "Build Options" (es: --disable-tiff) with "pip install Pillow" ?

hugovk commented 9 years ago

@pauloxnet This is already in the docs:

image

wiredfool commented 9 years ago

I don't think it's possible to use the disable options with pip, only with setup.py, and only then with the build_ext command.

pauloxnet commented 9 years ago

@hugovk I explicitly asked for information on the use of pip (I read the docs before asking) @wiredfool thanks for your reply. I just found this tips http://stackoverflow.com/a/31772244/755343 if it really works can you add this informations in Pillow's docs ?

wiredfool commented 9 years ago

I'm not sure that our docs need to be a reference on how to abuse pip. There's one way to do it, it's more obvious than using pip, and it's documented.

pauloxnet commented 9 years ago

Ok thanks for your reply

aclark4life commented 9 years ago

@pauloxnet @wiredfool Actually, I don't mind "pip hacks" however we should get someone from PyPA (https://github.com/pypa) to comment on this e.g. @dstufft. There is no mention of using build_ext with --global-option in pip's docs, however in order to decide on to-recommend-or-not we need to know how-good-or-bad this approach is according to PyPA. I don't fully understand the implications at the moment, but I like the idea of more-flexibility-with-pip vs. download-and-run-setup.py.

pauloxnet commented 9 years ago

@aclark4life thanks, I like the idea of more-flexibility-with-pip too.

lorenzog commented 8 years ago

This solved it for me on debian/ubuntu: apt-get install libjpeg-dev

cham-il-k commented 8 years ago

i had the same problem / and the warning about jpeg and the hint apt-get install libjpeg-dev solved my problem the ~ python setup.py install from the downloaded lreportlab compile very well

voneiden commented 8 years ago

The error message could be a bit more specific than "jpeg is required". But googling the error message lands now here, so I guess people will find their answers.

lucabezerra commented 8 years ago

I got here while trying to install mezzanine, but it was crashing when trying to install Pillow. The apt-get install libjpeg-dev tip also fixed it for me! Thanks :)

x0lan commented 8 years ago

Thanks @lorenzog! That worked for me also!

haomingz commented 8 years ago

CentOS can use yum install libjpeg-turbo-devel

sryze commented 8 years ago

How do you fix this on Windows? I was trying to install mitmproxy and came across this error. Removing %USERPROFILE%\AppData\Local\pip\cache didn't work for me.

wiredfool commented 8 years ago

Building on windows is complicated, you're much better off trying to use the prebuilt binaries that are on pypi.

majodi commented 8 years ago

sudo apt-get install libjpeg-dev fixed my reportlab install on Ubuntu also! Thnx

jakirkham commented 8 years ago

Running into this issue on Windows Python 3.4 32-bit only. Any thoughts?

I can give you logs, CIs, whatever you need to help diagnose/fix it. Here is a PR ( https://github.com/conda-forge/pillow-feedstock/pull/6 ) that gives you a head start on all of those things.

wiredfool commented 8 years ago

It's not a systemic issue on windows Py3.4/32. This is a recent appveyor master branch run on that platform: https://ci.appveyor.com/project/Python-pillow/pillow/build/3.3.pre.1131/job/v7nk6bgxpbutp6do

You might find this commit useful for debugging issues like this: https://github.com/python-pillow/Pillow/commit/80758e1bd7bf42ab6a62b63df57c386041e69bbd . It's not in 3.2, but it might help you find where things are going wrong.

jakirkham commented 8 years ago

Thanks @wiredfool. Will give that a try.

jakirkham commented 8 years ago

So, we tried the --debug flag and it appears to stop shy of telling us anything. Here is the relevant portion of the log.

wiredfool commented 8 years ago

You're not getting any stdout there, it should look something like this:

running build_ext
Appending path /Users/erics/Pillow/libImaging
Appending path /Users/erics/vpy27/lib
Appending path /Users/erics/vpy27/include
Appending path /usr/local/lib
Appending path /usr/local/include
Appending path /usr/local/Cellar/freetype/2.6.3/lib
Appending path /usr/local/Cellar/freetype/2.6.3/include
Tkinter found, will check for Tcl/Tk
Checking /py27/Tcl for tk.h
Checking /python27/Tcl for tk.h
Checking /Tcl for tk.h
Checking /Tcl85 for tk.h
Checking /Tcl8.5 for tk.h
Checking /Users/erics/Pillow/Tcl for tk.h
Tcl/tk not found
Appending path /usr/lib
Appending path /usr/include
Looking for zlib
Checking for include file zlib.h in /Users/erics/Pillow/libImaging
Checking for include file zlib.h in /Users/erics/vpy27/include
Checking for include file zlib.h in /usr/local/include
Checking for include file zlib.h in /usr/local/Cellar/freetype/2.6.3/include
Checking for include file zlib.h in /usr/include
Found zlib.h
Found library z at /usr/lib/libz.dylib
Looking for jpeg
Checking for include file jpeglib.h in /Users/erics/Pillow/libImaging
Checking for include file jpeglib.h in /Users/erics/vpy27/include
Checking for include file jpeglib.h in /usr/local/include
Found jpeglib.h
Found library jpeg at /usr/local/lib/libjpeg.dylib
Looking for jpeg2000
Checking for openjpeg-#.# in /Users/erics/Pillow/libImaging
Checking for openjpeg-#.# in /Users/erics/vpy27/include
Checking for openjpeg-#.# in /usr/local/include
Found openjpeg.h in /usr/local/include/openjpeg-2.1
Best openjpeg version (2, 1) so far in /usr/local/include/openjpeg-2.1
Checking for openjpeg-#.# in /usr/local/Cellar/freetype/2.6.3/include
Checking for openjpeg-#.# in /usr/include
Checking for openjpeg-#.# in /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7
Found library openjp2 at /usr/local/lib/libopenjp2.dylib
Inserting path /usr/local/include/openjpeg-2.1
Looking for tiff
Checking for include file tiff.h in /usr/local/include/openjpeg-2.1
Checking for include file tiff.h in /Users/erics/Pillow/libImaging
Checking for include file tiff.h in /Users/erics/vpy27/include
Checking for include file tiff.h in /usr/local/include
Found tiff.h
Found library tiff at /usr/local/lib/libtiff.dylib
Couldn't find library libtiff in ['/Users/erics/vpy27/lib', u'/usr/local/lib', u'/usr/local/Cellar/freetype/2.6.3/lib', '/usr/lib']
Looking for freetype
Found library freetype at /usr/local/lib/libfreetype.dylib
Checking for include file ft2build.h in /usr/local/include/openjpeg-2.1
Checking for include file ft2build.h in /usr/local/include/openjpeg-2.1/freetype2
Checking for include file ft2build.h in /Users/erics/Pillow/libImaging
Checking for include file ft2build.h in /Users/erics/Pillow/libImaging/freetype2
Checking for include file ft2build.h in /Users/erics/vpy27/include
Checking for include file ft2build.h in /Users/erics/vpy27/include/freetype2
Checking for include file ft2build.h in /usr/local/include
Checking for include file ft2build.h in /usr/local/include/freetype2
Found ft2build.h in /usr/local/include/freetype2
Inserting path /usr/local/Cellar/freetype/2.6.3/include/freetype2
Looking for lcms
Checking for include file lcms2.h in /usr/local/Cellar/freetype/2.6.3/include/freetype2
Checking for include file lcms2.h in /usr/local/include/openjpeg-2.1
Checking for include file lcms2.h in /Users/erics/Pillow/libImaging
Checking for include file lcms2.h in /Users/erics/vpy27/include
Checking for include file lcms2.h in /usr/local/include
Found lcms2.h
Found library lcms2 at /usr/local/lib/liblcms2.dylib
Checking for include file tk.h in /usr/local/Cellar/freetype/2.6.3/include/freetype2
Checking for include file tk.h in /usr/local/include/openjpeg-2.1
Checking for include file tk.h in /Users/erics/Pillow/libImaging
Checking for include file tk.h in /Users/erics/vpy27/include
Checking for include file tk.h in /usr/local/include
Checking for include file tk.h in /usr/local/Cellar/freetype/2.6.3/include
Checking for include file tk.h in /usr/include
Found tk.h
Looking for TCL
Couldn't find library tcl85 in ['/Users/erics/vpy27/lib', u'/usr/local/lib', u'/usr/local/Cellar/freetype/2.6.3/lib', '/usr/lib']
Found library tcl8.5 at /usr/lib/libtcl8.5.dylib
Looking for TK
Couldn't find library tk85 in ['/Users/erics/vpy27/lib', u'/usr/local/lib', u'/usr/local/Cellar/freetype/2.6.3/lib', '/usr/lib']
Found library tk8.5 at /usr/lib/libtk8.5.dylib
Looking for webp
Checking for include file webp/encode.h in /usr/local/Cellar/freetype/2.6.3/include/freetype2
Checking for include file webp/encode.h in /usr/local/include/openjpeg-2.1
Checking for include file webp/encode.h in /Users/erics/Pillow/libImaging
Checking for include file webp/encode.h in /Users/erics/vpy27/include
Checking for include file webp/encode.h in /usr/local/include
Found webp/encode.h
Checking for include file webp/decode.h in /usr/local/Cellar/freetype/2.6.3/include/freetype2
Checking for include file webp/decode.h in /usr/local/include/openjpeg-2.1
Checking for include file webp/decode.h in /Users/erics/Pillow/libImaging
Checking for include file webp/decode.h in /Users/erics/vpy27/include
Checking for include file webp/decode.h in /usr/local/include
Found webp/decode.h
Found library webp at /usr/local/lib/libwebp.dylib
Looking for webpmux
Checking for include file webp/mux.h in /usr/local/Cellar/freetype/2.6.3/include/freetype2
Checking for include file webp/mux.h in /usr/local/include/openjpeg-2.1
Checking for include file webp/mux.h in /Users/erics/Pillow/libImaging
Checking for include file webp/mux.h in /Users/erics/vpy27/include
Checking for include file webp/mux.h in /usr/local/include
Found webp/mux.h
Checking for include file webp/demux.h in /usr/local/Cellar/freetype/2.6.3/include/freetype2
Checking for include file webp/demux.h in /usr/local/include/openjpeg-2.1
Checking for include file webp/demux.h in /Users/erics/Pillow/libImaging
Checking for include file webp/demux.h in /Users/erics/vpy27/include
Checking for include file webp/demux.h in /usr/local/include
Found webp/demux.h
Found library webpmux at /usr/local/lib/libwebpmux.dylib
Found library webpdemux at /usr/local/lib/libwebpdemux.dylib
Couldn't find library libwebpmux in ['/Users/erics/vpy27/lib', u'/usr/local/lib', u'/usr/local/Cellar/freetype/2.6.3/lib', '/usr/lib']
Looking for TclTk Framework Build
--- using frameworks at /System/Library/Frameworks
Inserting path /System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers
Inserting path /System/Library/Frameworks/Tk.framework/Versions/8.5/Headers
building 'PIL._imaging' extension
creating build
creating build/temp.macosx-10.9-x86_64-2.7
creating build/temp.macosx-10.9-x86_64-2.7/libImaging
Building using 4 processes
jakirkham commented 8 years ago

You're right. I thought I had fixed that issue, but I picked up a bad commit again. I'll need to table this one for a bit though and either I or someone else will pick this up when we have some more time. Thanks again for your help.

zhan0483 commented 7 years ago

Finnally, it is working!!!!! Thanks!

I got problem decoder PNG / JEPG not avilable. Following works for me.

pip uninstall Pillow clear cache rm -rf ~/.cache/pip pip install Pillow=2.6.0