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?

franco_b
  • 211
  • You did use sudo to install pillow, right? – don.joey Nov 14 '14 at 11:26
  • sure I use sudo also. – franco_b Nov 14 '14 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 '14 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 '14 at 13:40

4 Answers4

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

benjaoming
  • 115
  • 5
Tony Joseph
  • 181
  • 1
  • 4
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
TheWanderer
  • 19,395
  • 12
  • 50
  • 65
Manuel
  • 21
  • 1
0

try to install this development dependencies:

sudo apt-get install python-dev python-setuptools
David Foerster
  • 36,264
  • 56
  • 94
  • 147
Ros
  • 11
  • 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. – RPiAwesomeness Sep 10 '15 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
Ramon
  • 1