PIL does support JPEG in my system.
Whenever I do an upload, my code is failing with:
File "PIL/Image.py", line 375, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
How can I resolve this?
Best Answer
libjpeg-dev is required to be able to process jpegs with pillow (or PIL), so you need to install it and then recompile pillow. It also seems that libjpeg8-dev is needed on Ubuntu 14.04
If you're still using PIL then you should really be using pillow these days though, so first
pip uninstall PIL
before following these instructions to switch, or if you have a good reason for sticking with PIL then replace "pillow" with "PIL" in the below).On Ubuntu:
If that doesn't work, try one of the below, depending on whether you are on 64bit or 32bit Ubuntu.
For Ubuntu x64:
Or for Ubuntu 32bit:
Then reinstall pillow:
(Edits to include feedback from comments. Thanks Charles Offenbacher for pointing out this differs for 32bit, and t-mart for suggesting use of
--no-cache-dir
).