41

I recently failed trying to install Pillow 3.0.0 on my Ubuntu 14.04.

No matter what I do (download and try to sudo python setup.py install or sudo -H pip install Pillow==3.0.0 --no-cache-dir) every time I get error:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-3waMkf/Pillow/setup.py", line 767, in <module>
        zip_safe=not debug_build(),
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
        self.run_command('build')
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
        self.run_command(cmd_name)
      File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/distutils/command/build_ext.py", line 337, in run
        self.build_extensions()
      File "/tmp/pip-build-3waMkf/Pillow/setup.py", line 515, in build_extensions
        % (f, f))
    ValueError: --enable-zlib requested but zlib not found, aborting.

    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-3waMkf/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-S_sHo7-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-3waMkf/Pillow
daaawx
  • 3,273
  • 2
  • 17
  • 16
user3613919
  • 777
  • 1
  • 7
  • 17

1 Answers1

71

Did you install the dependencies for pillow ? You can install them by

$ sudo apt-get build-dep python-imaging
$ sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
Yash Mehrotra
  • 3,032
  • 1
  • 21
  • 24
  • 1
    Thank you! That was it. You've been very helpful :) – user3613919 Oct 29 '15 at 01:27
  • What if I'm using a virtual env and just want to use Pillow without installing anything in my system? – David Dahan Dec 22 '15 at 02:15
  • 3
    The above are system wide dependencies, what `pip` does is, it only installs the module/library. Sometimes, libraries require to use things at system level which may not be installed by default. Whether you are using a virtualenv or installing it globally, you have to install these libraries to use Pillow. – Yash Mehrotra Dec 22 '15 at 02:25
  • 3
    Ok Thanks. For Mac OS X 10.9 users: `brew install Homebrew/python/pillow`, `brew link jpeg`, `xcode-select --install` are command which allow you then to make a `pip install pillow`. – David Dahan Dec 22 '15 at 12:34
  • I just what to know where to find the dependencies instead of SO, is there any doc we should read? – shellbye Apr 11 '16 at 13:29
  • @shellbye Ideally, the library should list the dependencies and installation instructions for popular operating systems in their docs. SO comes to the rescue when they don't. – Yash Mehrotra Apr 12 '16 at 15:56
  • @YashMehrotra Now I know where to look at next time, thanks. – shellbye Apr 13 '16 at 01:45