57

How do I install PIL?

>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 /root/.pip/pip.log 

>pip uninstall PIL
Can't uninstall 'PIL'. No files were found to uninstall.
Cœur
  • 37,241
  • 25
  • 195
  • 267
Droid
  • 1,410
  • 8
  • 23
  • 37
  • These along with the above mentioned command by @JCotton helped me get PIL Installed on my Ubuntu 14.4 x64 https://gist.github.com/shingonoide/8172291 http://codeinthehole.com/writing/how-to-install-pil-on-64-bit-ubuntu-1204/ – Kumar Deepam Jul 06 '14 at 19:15

2 Answers2

144

pip install PIL --allow-external PIL --allow-unverified PIL

This is due to changes in the new version of Pip. Run pip --version and I'm willing to bet you are running 1.5. See the changelog here. This new default behavior enhances security. In PIL's case, the file you are installing actually comes from effbot.org (thus --allow-external) and PyPi doesn't have a checksum to guarantee validity (thus --allow-unverified).

Also, you might consider using the Pillow replacement to PIL.

JCotton
  • 11,650
  • 5
  • 53
  • 59
  • 1
    thanks bro, it working, I've been using pillow, but But when I uploaded the picture it still did not show – Droid Jan 20 '14 at 20:23
  • I have another problem, pip uninstall PIL can't uninstall PIL No files were found to uninstall. how to uninstall PIL? – Droid Jan 20 '14 at 20:31
  • `pip uninstall PIL` works fine for me. Are you in the same virtualenv? Does `pip freeze` list PIL as being installed? – JCotton Jan 20 '14 at 21:39
  • 2
    Well, looks like in Python 3.5.2 `--allow-external` and `--allow-unverified` got deprecated and has no longer any effect... Thought, `pip install pillow` seem to works fine. – antogerva Jul 18 '16 at 10:07
38

Updated info for those reading in 2016:

--allow-external

and

--allow-unverified

were recently deprecated. Installing packages external to PyPi using pip is no longer supported: http://www.python.org/dev/peps/pep-0470/

As an alternative, when you really need to install that external package, you can download the source code and run its setup.py. For example, for PIL 1.1.7, download from http://www.pythonware.com/products/pil/, then:

$ tar xvfz Imaging-1.1.7.tar.gz
$ cd Imaging-1.1.7
$ python setup.py install

(^ from the PIL README)

If you only want to install the package to a specific virtualenv, you can just activate your virtualenv first. ** thanks @Caumons

Alternatively, substitute the path to your virtualenv for 'python' in the third line, e.g.:

$ /home/username/virtualenv-name/bin/python setup.py install
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
tated
  • 621
  • 7
  • 11