4

By default, PIL doesn't have jpeg support on the Raspberry Pi, so it returns the following:

IOError: decoder jpeg not available

This can also be seen while installing PIL:

*** JPEG support not available
5

TL;DR: uninstall PIL, install and link libjpeg-dev, and reinstall PIL.

The general solution is to install libjpeg-dev before installing PIL:

sudo apt-get install libjpeg8-dev

However, PIL still doesn't know where to find the shared library. Following the general solution (above) doesn't work since the Pi is ARM-based, not intel32/64. Still, it isn't hard to find the library and link it:

find /usr/lib -name libjpeg.so
/usr/lib/arm-linux-gnueabihf/libjpeg.so
sudo ln -s /usr/lib/arm-linux-gnueabihf/libjpeg.so /usr/lib/

reinstalling PIL works properly now:

sudo pip install PIL
...
--- JPEG support available

hoorays!

  • When running /usr/lib/arm-linux-gnueabihf/libjpeg.so, I get a premission denied error. However, when I try to use sudo /usr/lib/arm-linux-gnueabihf/libjpeg.so, it says command is not found. How can I fix this? – Human Aug 29 '15 at 19:33
  • The .so is a library, not an executable, @human – tedder42 Aug 30 '15 at 21:35
  • Thanks. For reference, this also resolves the mirror issue with Pillow/Python3 – Basic Jul 17 at 23:50
2

Another solution is to install PIL (actually, the Pillow fork) via,

sudo apt-get install python-imaging

as recommended in this answer. This will also install the dependencies required for JPEG support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.