10

I went to This site for installing Pillow since the original PIL is a discontinued project and so now not so good to use. But, in the table support for Ubuntu 16.04 LTS is unmentioned. It appears neither in the 4.2.x installation guide, or in the 3.0.0 installation guide.

Further, just installing pillow is said to be not enough. There are some dependencies that should be installed first which is also unmentioned for Ubuntu 16.04 LTS. Would the installation steps for Pillow for python 3 given for 14.04 LTS be OK for Ubuntu 16.04 LTS?

If not, How do I install pillow in 16.04 LTS for Python 3.6? (There is support for Python 2.)

Eliah Kagan
  • 117,780

3 Answers3

15

According to Wikipedia Pillow is packaged as python-pil and python3-pil in Ubuntu 13.04 and later.

To install the Python Imaging Library in Ubuntu 16.04 and later (and also in Ubuntu 14.04), open the terminal and type:

sudo apt install python-pil # for python 2.X

and/or...

sudo apt install python3-pil # for python 3.X including python3.6

And if the imageTk import doesn't work, just do this:

sudo apt install python3-pil.imagetk
karel
  • 114,770
  • it's really said to be better not to use a discontinued project. Do you think it's ok to use PIL? It's available for >python3.5, but not in Ubuntu16.04LTS. But, I gave a shot installing PILLOW by installing the dependencies 14LTS way and it works! Is it gonna cause issues later? – mathmaniage Sep 26 '17 at 09:05
  • 1
    Just getting a bit confused: PIL was discontinued so Pillow was forked, and now the devs make PIL uptodate by forking Pillow? – mathmaniage Sep 26 '17 at 09:12
  • 2
    Pillow is packaged as either python-pil for Python 2.X or python3-pil for Python 3.X in Ubuntu 16.04. So in Ubuntu 16.04 you are getting Pillow, not the discontinued PIL project packages from the default Ubuntu repositories. – karel Sep 26 '17 at 09:37
  • what about the dependencies?, There are installation instructions for ubuntu 14.04LTS only – mathmaniage Sep 26 '17 at 10:12
  • 1
    When you install a package with apt-get or apt, the dependencies are resolved by apt automatically. – karel Sep 26 '17 at 10:16
3

Ubuntu 18.04 and Python 3

This will interest users past Ubuntu 16.04 LTS: install_pillow.sh

#!/bin/bash

apt update apt install python3-pip -y apt install libjpeg8-dev zlib1g-dev libtiff-dev libfreetype6 libfreetype6-dev libwebp-dev libopenjp2-7-dev libopenjp2-7-dev -y

pip3 install pillow --global-option="build_ext" --global-option="--enable-zlib" --global-option="--enable-jpeg" --global-option="--enable-tiff" --global-option="--enable-freetype" --global-option="--enable-webp" --global-option="--enable-webpmux" --global-option="--enable-jpeg2000"

This also addresses some of the "dependencies" which I believe OP was referring to:

0
$sudo easy_install pip==20.3.4
$sudo apt-get build-dep pillow
$sudo pip2 install pillow

Successfully installed pillow-6.2.2

This solution was tested on:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.7 LTS
Release:    16.04
Codename:   xenial

It was run on 32bit Chromenotebook :)