Will & Skill Developers

Will & Skill Developers


Thoughts, snippets and ideas from the team at Will & Skill AB, Stockholm.

Faisal Mahmud
Author

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

Share


Resolving IOError: decoder jpeg not available when installing PIL/Pillow

Faisal MahmudFaisal Mahmud

1. Uninstall the broken packages

If you have installed PIL

pip uninstall PIL

If the line above does not work you can try this

rm -rf /usr/lib/python2.7/site-packages/PIL
rm -rf /usr/lib/python2.7/site-packages/PIL.pth

Or if you have installed Pillow

pip uninstall pillow

2. Install necessary packages from APT

In Ubuntu

sudo apt-get install libjpeg-dev libfreetype6-dev
sudo apt-get install zlib1g-dev libpng12-dev

3. Reinstall Pillow

And now reinstall pillow

pip install pillow

The installation log should look something like below...

  --- PIL CORE support ok
  --- TKINTER support ok
  --- JPEG support ok
  --- ZLIB (PNG/ZIP) support ok
  --- FREETYPE2 support ok
  *** LITTLECMS support not installed
  ----------------------------------------
  Running selftest:
  --- 57 tests passed.

If it still does not work try the suggestions below...

1. Uninstall PIL/Pillow (see point 1 above)

2. Create some symlinks...

For Ubuntu x64

sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

For Ubuntu 32-bit

sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so.6 /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/

3. Reinstall Pillow

Faisal Mahmud
Author

Faisal Mahmud

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

Comments