User avatar
paddyg
Posts: 1916
Joined: Sat Jan 28, 2012 11:57 am

Re: Trouble installing Pillow / PIL

Sat Aug 02, 2014 9:59 am

Oh well, I re-direct the message on to the debian maintainers! I was going by the instructions of the pillow site here and what I had to do to simply apt-get install python-pil on this vanilla ubuntu laptop.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

supra
Posts: 726
Joined: Thu Feb 28, 2013 9:21 am
Location: Ontario, Canada

Re: Trouble installing Pillow / PIL

Fri Aug 22, 2014 2:14 pm

tm48 wrote:
Traceback (most recent call last):
File "/home/pi/testide.py", line 1, in <module>
from PIL import Image
ImportError: No module named PIL
This is for only python 3.2.3.
wheezy Release date:2014-06-20

Ignoring all error problems. I had same error as a above. Your code is working fine. No problem. :o :o :o
Just type command
sudo python testide.py
You will get all jpeg pictures :D :D :D :D

tm48
Posts: 19
Joined: Mon May 26, 2014 12:07 pm

Re: Trouble installing Pillow / PIL

Thu Aug 28, 2014 2:02 pm

I updated my raspberry pi and then tried this:

Code: Select all

 sudo apt-get install python-pil 
I got the following error:
Reading package lists... Done
Building dependecy tree
Reading state information... Done
E: Unable to locate package python-pil
How can I fix this?

User avatar
paddyg
Posts: 1916
Joined: Sat Jan 28, 2012 11:57 am

Re: Trouble installing Pillow / PIL

Thu Aug 28, 2014 4:19 pm

see some notes I put up for installing pi3d here

For some reason pillow has still not displaced the aged and unsupported PIL from mainstream debian (though it has done for other distributions). But it will do quite soon and is available in the 'jessie' development version of raspbian. You need to edit
/etc/apt/sources.list
and add a new line

Code: Select all

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
then

Code: Select all

sudo apt-get update
sudo apt-get install python-pil
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

tm48
Posts: 19
Joined: Mon May 26, 2014 12:07 pm

Re: Trouble installing Pillow / PIL

Wed Sep 03, 2014 7:20 am

I changed the sources.list file but when I tried updating I got this error:
W: Failed to fetch http://mirrordirector.rapsbian.org/rasp ... essie/main /i18n/Translation-en Something wicked happened resolving 'mirrordirector.rapsbi an.org:http' (-5 - No address associated with hostname)
E: Some index files failed to download. They have been ignored, or old ones used instead.
How can I fix this?

This is what my sources.list file looks like right now:

Code: Select all

deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
deb http://mirrordirector.rapsbian.org/raspbian/ jessie main contrib non-free rpi
Is it a problem to have both wheezy and jessie on there?

User avatar
paddyg
Posts: 1916
Joined: Sat Jan 28, 2012 11:57 am

Re: Trouble installing Pillow / PIL

Wed Sep 03, 2014 11:02 am

Well 'something wicked' doesn't sound good. But the message looks as though there is a gap: 'raspbi an' are you sure that whatever editor you used to modify the file hasn't put some invisible character in there? It does sound unlikely!

I would have said that having both wheezy and jessie as sources was ok but yesterday I tried installing the epiphany-browser and ran 'sudo apt-get dist-upgrade' and a) it took hours b) critical graphics functionality became broken. So I would suggest removing the jessie line after you have installed pillow PIL. Also, although sudo apt-get install python-pil was pretty quick, sudo apt-get install python3-pil took ages, probably longer than compiling the whole thing with pip!
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

mikedlong
Posts: 1
Joined: Sun Feb 22, 2015 9:22 pm

Re: Trouble installing Pillow / PIL

Thu Feb 26, 2015 12:03 am

The easiest why I've found to keep from getting the error is the following:
I tested and tested and reinstalled until I finally got to this installation routine that keeps me from getting the PIL error without changing anything in sources.list.

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install python3-setuptools

sudo easy_install3 picamera

sudo apt-get install python-imaging-tk

Since I started doing this from a fresh install of PI I've not seen the PIL error again.

mrswadge
Posts: 1
Joined: Sat Dec 03, 2016 10:34 am

Re: Trouble installing Pillow / PIL

Sat Dec 03, 2016 10:44 am

The documentation here failed me: https://www.raspberrypi.org/learning/ge ... /software/
For a start it was pip-3.2 instead of pip3, then I got install errors when installing pillow.

Code: Select all

sudo pip-3.2 install pillow
[snip:large wall of text with this error in it...]
ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting
Once I had done the following from DirkS it worked...

Code: Select all

sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev \ libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev
sudo pip-3.2 install pillow
Takes a while, but you should end up with this summary.

Code: Select all

    --------------------------------------------------------------------
    PIL SETUP SUMMARY
    --------------------------------------------------------------------
    version      Pillow 3.4.2
    platform     linux2 3.2.3 (default, Mar  1 2013, 11:53:50)
                 [GCC 4.6.3]
    --------------------------------------------------------------------
    --- JPEG support available
    *** OPENJPEG (JPEG2000) support not available
    --- ZLIB (PNG/ZIP) support available
    *** LIBIMAGEQUANT support not available
    --- LIBTIFF support available
    --- FREETYPE2 support available
    --- LITTLECMS2 support available
    --- WEBP support available
    *** WEBPMUX support not available
    --------------------------------------------------------------------
    To add a missing option, make sure you have the required
    library and headers.
    See https://pillow.readthedocs.io/en/latest/installation.html#building-from-source

    To check the build, run the selftest.py script.

User avatar
paddyg
Posts: 1916
Joined: Sat Jan 28, 2012 11:57 am

Re: Trouble installing Pillow / PIL

Sat Dec 03, 2016 4:57 pm

in case anyone arrives at this thread after searching for help with the PIL module on RPi; Pillow is already installed with Raspbian jessie so you don't have to worry about any of this.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
Etienne
Posts: 182
Joined: Wed Jul 24, 2013 6:23 am

Re: Trouble installing Pillow / PIL

Thu Dec 08, 2016 10:53 pm

Hello paddyg,

I have an 'old' PI A version that works fine. I am trying to install Pillow (for python 2.7) but I failled so far, I made

Code: Select all

sudo apt-get update
sudo apt-get upgrade
reboot the Pi

Code: Select all

pi@rpi2A:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
You mention PILis preinstalled in Jessie but I get the following:

Code: Select all

$ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>>
I try installing using

Code: Select all

sudo apt-get install python-imaging
But I get the following error : its in french but means
dpkg warning missing packet « fontconfig-config »
dpkg warning missing packet « fonts-dejavu-core »
dpkg fatal error, the list of files for « libatk1.0-data » has no line return at the end of the file

Code: Select all

Sélection du paquet liblcms2-2:armhf précédemment désélectionné.
dpkg : avertissement : le fichier contenant la liste des fichiers du paquet « fontconfig-config » étant manquant, il est considéré qu'aucun fichier du paquet n'est actuellement installé
dpkg : avertissement : le fichier contenant la liste des fichiers du paquet « fonts-dejavu-core » étant manquant, il est considéré qu'aucun fichier du paquet n'est actuellement installé
dpkg : erreur fatale irréversible, abandon :
 la liste des fichiers pour le paquet « libatk1.0-data » n'a pas de retour à la ligne en fin de fichier
E: Sub-process /usr/bin/dpkg returned an error code (2)
Any idea in which direction I should looked at? thank you.

User avatar
paddyg
Posts: 1916
Joined: Sat Jan 28, 2012 11:57 am

Re: Trouble installing Pillow / PIL

Thu Dec 08, 2016 11:42 pm

Hmm, maybe Pillow hasn't been built for *all* possible flavours of RPi... But it is possible to install it on the old RPi A as I have done it numerous times. As a first step I would try
$ sudo apt-get install python-pillow # or ideally python3-pillow
If that doesn't work you will see here what I suggested prior to the inclusion of Pillow as the standard PIL

Basically something like:

Code: Select all

$ cd ~
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python3-dev python3-setuptools libjpeg-dev zlib1g-dev libpng12-dev libfreetype6-dev
$ sudo apt-get install python3-pip
$ sudo pip-3.2 install Pillow
or, if you want to stick with python 2.7 use python-dev, python-setuptools, python-pip and pip install. It will have to compile quite a lot of stuff so will take a while (15 to 30 minutes). Or if you don't want pip you could download the Pillow tar.gz file from pypi.python.org, extract it on you RPi then from the extracted directory run
$ sudo python setup.py install
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
Etienne
Posts: 182
Joined: Wed Jul 24, 2013 6:23 am

Re: Trouble installing Pillow / PIL

Sat Dec 10, 2016 7:33 am

Thank you paddyg,

unfortunatly, the first method lead to the same type of error:
dpkg warning missing packet « fontconfig-config »
dpkg warning missing packet « fonts-dejavu-core »
dpkg fatal error, the list of files for « libatk1.0-data » has no line return at the end of the file

I also try to download the Pillow-2.7.0.tar.gz, then I need to install setup tool (sudo python setup.py install) which is ok.
But I still get an error when I type sudo python setup.py install:
_imaging.c:76:20: fatal error: Python.h: Aucun fichier ou dossier de ce type
#include "Python.h"
^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
I think I will need to reinstal from scratch and try it again... may be its related to the fact I am using Jessie lite on a A version Pi...

User avatar
paddyg
Posts: 1916
Joined: Sat Jan 28, 2012 11:57 am

Re: Trouble installing Pillow / PIL

Sat Dec 10, 2016 8:51 am

Ah, jessie lite doesn't have many of the dependencies already installed - you have to add them yourself. Google each of the missing modules etc. in the error message and see what needs to be intalled.

However I have fairly recently installed Pillow on jessie lite and run it ok on an old type A though I did do all the setup on a type 3 for speed. The istructions are on the pi3d faq page.
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
paddyg
Posts: 1916
Joined: Sat Jan 28, 2012 11:57 am

Re: Trouble installing Pillow / PIL

Sat Dec 10, 2016 10:37 am

@Etienne, just tried following my own instructions here, as I hadn't gone through the process with a fresh micro SD image for a few months, and it does seem to install pillow OK and it does run on a fairly ancient model A. The only proviso is that I couldn't find a USB wifi dongle so plugged the card into model 3, but only to do the apt-getting. Also I did it for python3 and python3-pillow (which redirects to python3-pil I notice) However, unless you have a very good reason not to, I would recommend switching to python3 now as most developers (such as me) will put their effort into ensuring apps work with python3 first then into persuading users to switch to python3 and finally into fixing things to work on python2!
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
Etienne
Posts: 182
Joined: Wed Jul 24, 2013 6:23 am

Re: Trouble installing Pillow / PIL

Sat Dec 10, 2016 3:58 pm

@paddyg,
I also run a fresh Pi A / Jessi lite install without any error with all extension I need (cv2, picamera, appache, php, PIL,)!... so I guess I made something wrong on my previous set-up.
Anyway now I need to migrate al my project on the new card. Also switching to python is something I need to look at sooner or later...
Thank you for helping.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 79 guests