Skip to content

Instantly share code, notes, and snippets.

@DavidToca
Last active May 7, 2018 17:03
Show Gist options
  • Save DavidToca/6063298 to your computer and use it in GitHub Desktop.
Save DavidToca/6063298 to your computer and use it in GitHub Desktop.
Install PIL on linux
sudo apt-get update ;
sudo apt-get install libjpeg-turbo8-dev libjpeg8-dev ;
sudo apt-get install libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev zlib1g-dev libfreetype6-dev liblcms1-dev libjpeg62-dev;
sudo apt-get build-dep python-imaging
#PIL cant find the files he needs, so we need to make symlinks to the files he looks for
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ ;
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ ;
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/;
#be sure you are in the enviroment you need to install PIL (in case you are using virtualenv)
pip uninstall PIL ; pip install PIL
@bgarcial
Copy link

bgarcial commented May 7, 2014

Hi David, I using this procedure, in muy app get the message
Exception Type: IOError
Exception Value: decoder jpeg not available

But it occurred to me something special:
The package libjpeg62 enter in conflict with the packages libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev
If I install one, the system remove the others and so...

In addition, this procedure or packages is for works with PIL really?
My pip package manager not found PIL or pil, I get this message ...

(venv)➜ project pip install PIL
Downloading/unpacking PIL
Could not find any downloads that satisfy the requirement PIL
Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL
Storing debug log for failure in /home/bgarcial/.pip/pip.log
(venv)➜ project

In the logs says me that the externals urls are disallowed ...
I gess that I should learn the flags of pip for --allow-external

I have install Pillow (2.4.0), but I don't if this is compatible with pil.
Excuse for this post, may be you know some solution about it. Thanks

@bgarcial
Copy link

bgarcial commented May 7, 2014

I solve the problem according this link http://stackoverflow.com/questions/8915296/python-image-library-fails-with-message-decoder-jpeg-not-available-pil

install libjpeg-dev with apt

sudo apt-get install libjpeg-dev

reinstall pillow

pip install -I pillow

The package libjpeg-dev you says that is necessary install too, is possible that in my system the conflict with libjpeg62 uninstall libjpeg-dev in the last opportunity and I don't know this.

Of any way thanks for your gist about it. It's very useful for me. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment