I get the following error when installing ImageTK.

% sudo apt-get install python-pil python-imaging python-imaging-tk

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-pil is already the newest version.
Suggested packages:
  python-pil-doc python-pil.imagetk-dbg
The following NEW packages will be installed:
  python-imaging python-imaging-tk python-pil.imagetk
0 upgraded, 3 newly installed, 0 to remove and 41 not upgraded.
Need to get 0 B/31.7 kB of archives.
After this operation, 111 kB of additional disk space will be used.
Selecting previously unselected package python-imaging.
dpkg: warning: files list file for package 'linux-libc-dev:armhf' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'qdbus' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

1 Answer 1


I don't know what version you are using. This answer is for Raspbian stretch. You should first upgrade:

pi ~$ sudo apt update
pi ~$ sudo apt full-upgrade

Then install packets separate. No need to install python-pil. This will be install automatically with python-imaging. python-imaging-tk is only a virtual packet and will install python-pil.imagetk. So do it direct:

pi ~$ sudo apt install python-imaging
pi ~$ sudo apt install python-pil.imagetk

If then there are still missing packets try to install them. At least you can clean up your apt-lists. But this should be done with caution. Afterwards repeat the commands from beginning.

pi ~$ sudo rm /var/lib/apt/lists/*

You have also to address the repositories, at least these two:

pi ~$ cat /etc/apt/sources.list
deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi

pi ~$ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ stretch main ui

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.