11

I'm crazy with Pillow. I already ask here, without solving:

Python Django Mezzanine install fail for Pillow package

I have Ubuntu 14.04 and python 2.7.

Installing pillow using pip or from github I have this error:

x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/_imaging.o: File o directory non esistente
x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/decode.o: File o directory non esistente
x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/encode.o: File o directory non esistente
x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/map.o: File o directory non esistente
x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/display.o: File o directory non esistente
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ctXrZt-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/Pillow
Traceback (most recent call last):
 File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
 File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args)
 File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 28: ordinal not in range(128)

Naturally I follow this also:

PIL install in Ubuntu 14.04.1 LTS

Maybe there is some library conflict. I try to remove all and install again but I have always same error.

Have you a suggest?

4
  • You did use sudo to install pillow, right?
    – don.joey
    Nov 14, 2014 at 11:26
  • sure I use sudo also.
    – franco_b
    Nov 14, 2014 at 13:14
  • You forget to mention that you are using a virtualenv. Deactivate your virtualenv. Install pillow system wide with sudo apt-get install python-pil. Reactivate your virtualenv. Run sudo pip install pillow.
    – don.joey
    Nov 14, 2014 at 13:18
  • I already have installed most recent version of python-pil, anyway you have right I forgot to say that I'd insatll Pillow using virtualenv
    – franco_b
    Nov 14, 2014 at 13:40

4 Answers 4

18

Firstly, you need the python-dev package because Pillow needs compile headers defined.

sudo apt-get install python-dev

On Ubuntu 14.04 you need few extra packages to get pillow working. Install all of them with the command:

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

This will work for both python 2.x and python 3.x. You might not need all of these, but at the very least you should install libjpeg8-dev and zlib1g-dev for JPEG and PNG support.

If you are using Ubuntu 12.04, use the following command.

sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk

Detailed instructions can be found at official pillow documentation.

Installation — Pillow (PIL Fork) 2.6.1 documentation

1
  • 1
    For python 3 run $ sudo apt-get install python3-dev Mar 25, 2017 at 14:55
1
sudo apt-get install python-dev python-setuptools

and

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
4
  • 2
    Please expand on your answer a little. Oct 16, 2015 at 18:13
  • 1
    Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) Oct 17, 2015 at 12:37
  • This is actually the most correct answer. I don't understand quite why it got down-voted and then someone replaced it with a new answer -- should've just been modified with more explanations, no?
    – benjaoming
    Jan 11, 2016 at 16:29
  • This worked for me on debian 8, but I had to remove libjpeg8-dev from the list. Jan 2, 2018 at 10:26
0

try to install this development dependencies:

sudo apt-get install python-dev python-setuptools
1
  • 1
    While this may technically answer the question, it's usually better to include a bit of explanation as to what this will do, instead of just the raw commands. Sep 10, 2015 at 14:44
0

In addition to the above installs I still had the above error installing Pillow.

To fix the error, navigate to /usr/include:

cd /usr/include

Create a symlink, pointing to the freetype2-directory:

ln -s freetype2 freetype

You must log in to answer this question.

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