19

On Debian testing (Jessie), when I try to install PIL or Pillow (python imaging libs) in a virtualenv via pip I get the following error:

running egg_info
writing Pillow.egg-info/PKG-INFO
writing top-level names to Pillow.egg-info/top_level.txt
writing dependency_links to Pillow.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'Pillow.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'Pillow.egg-info/SOURCES.txt'
running build_ext
building 'PIL._imaging' extension
creating build/temp.linux-x86_64-2.7/libImaging
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/local/include -I/usr/include -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -c _imaging.c -o build/temp.linux-x86_64-2.7/_imaging.o
_imaging.c:76:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
                    ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I have installed all dependencies for Pillow, based on my experience with Wheezy, but it seems something is different with testing.

Any suggestions?

EDIT

In fact I discovered another problem with libc6. The version I had was from experimental. After downgrading it to testing's version, I reinstalled all dependencies but now I get a different error:

building 'PIL._imagingft' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/freetype2 -IlibImaging -I/usr/include/tcl8.5 -I/usr/local/include -I/usr/include -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -c _imagingft.c -o build/temp.linux-x86_64-2.7/_imagingft.o
_imagingft.c:62:31: fatal error: freetype/fterrors.h: No such file or directory
 #include <freetype/fterrors.h>
                               ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

It seems the experimental version of libc6 messed things up, but I can't figure out what's wrong. Aptitude doesn't show any unmet dependencies and aptitude install -f does nothing.

Also, if indeed the linux-headers are relevant, the ones I have installed are:

  • linux-headers-3.11-2-all
  • linux-headers-3.11-2-all-amd64
  • linux-headers-3.11-2-amd64
  • linux-headers-3.11-2-common
  • linux-headers-3.2.0-4-amd64
  • linux-headers-3.2.0-4-common
  • linux-headers-amd64
2
  • Did you installed the kernel headers (the error seems that it's related, somehow).
    – Braiam
    Dec 15, 2013 at 16:15
  • 1
    Linux headers are irrelevant, it's python headers that are missing. Dec 15, 2013 at 20:50

5 Answers 5

28

In Ubuntu 14.04 try:

sudo ln -s /usr/include/freetype2 /usr/local/include/freetype
23

You need the python development headers, and possibly other development packages. Easiest way to get them is:

sudo apt-get build-dep python-imaging
3
  • Already tried that. In fact I can normally install python-imaging system-wide with aptitude, though I did not try to actually use it.
    – alekosot
    Dec 15, 2013 at 19:16
  • interesting. What's the output of that command? Dec 15, 2013 at 20:49
  • this worked for me in Ubuntu 14.04 Feb 16, 2015 at 21:23
3

After installing the development version of Pillow, the second problem was solved as well. It may be related to this issue.

So to sum up, the solution was:

  1. Install dependencies as Dennis said, which in my case also included downgrading the experimental version of libc6 with aptitude remove libc6, which granted the option to DOWNGRADE it to the repo's version.

  2. Installing the Pillow's trunk version with pip install git+git://github.com/python-imaging/Pillow.git

3

I'm using Debian 7 testing, and for me it worked doing this:

  1. Installing the dependencies as said by Dennis:

    $ sudo apt-get build-dep python-imaging
    
  2. Making a symbolic link as suggested by mrudult:

    $ sudo ln -s -T /usr/include/freetype2/ /usr/include/freetype
    
  3. Install Pillow as usual:

    $ pip install Pillow
    
1

On a fresh Ubuntu 14.04 install on DigitalOcean, I was able to solve this problem by simply running

sudo apt-get install python-dev

and then re-running the pip install command inside the python venv

pip install Pillow

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .