install pillow on ubuntu 14.04

26,919

Solution 1

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

Solution 2

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
Share:
26,919

Related videos on Youtube

franco_b
Author by

franco_b

Updated on September 18, 2022

Comments

  • franco_b
    franco_b over 1 year

    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?

    • Admin
      Admin over 9 years
      You did use sudo to install pillow, right?
    • Admin
      Admin over 9 years
      sure I use sudo also.
    • Admin
      Admin over 9 years
      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.
    • Admin
      Admin over 9 years
      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
  • RPiAwesomeness
    RPiAwesomeness over 8 years
    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.
  • TheWanderer
    TheWanderer over 8 years
    Please expand on your answer a little.
  • David Foerster
    David Foerster over 8 years
    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.)
  • user3829105
    user3829105 over 8 years
    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?
  • Michael Radionov
    Michael Radionov about 7 years
    For python 3 run $ sudo apt-get install python3-dev
  • Programster
    Programster over 6 years
    This worked for me on debian 8, but I had to remove libjpeg8-dev from the list.