Ubuntu – install pillow on ubuntu 14.04

djangopippythonsoftware installation

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?

Best Answer

  • 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