21

The installation process asks for zlib and I even setup & cloned it from Github. I'm new to all of this.

Error message:

C:\Users\GThell\Pillow>pip install -e .
Obtaining file:///C:/Users/GThell/Pillow
Requirement already satisfied: olefile in c:\users\gthell\appdata\local\programs\python\python36\lib\site-packages (from Pillow==3.5.0.dev0)
Installing collected packages: Pillow
  Running setup.py develop for Pillow
    Complete output from command c:\users\gthell\appdata\local\programs\python\python36\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\GThell\\Pillow\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
    Single threaded build for windows
    running develop
    running egg_info
    writing Pillow.egg-info\PKG-INFO
    writing dependency_links to Pillow.egg-info\dependency_links.txt
    writing requirements to Pillow.egg-info\requires.txt
    writing top-level names to Pillow.egg-info\top_level.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'Pillow.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files found matching '.coveragerc'
    warning: no previously-included files found matching '.editorconfig'
    warning: no previously-included files found matching '.landscape.yaml'
    warning: no previously-included files found matching 'appveyor.yml'
    warning: no previously-included files found matching 'tox.ini'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    writing manifest file 'Pillow.egg-info\SOURCES.txt'
    running build_ext


    The headers or library files could not be found for zlib,
    a required dependency when compiling Pillow from source.

    Please see the install instructions at:
       http://pillow.readthedocs.io/en/latest/installation.html

    Traceback (most recent call last):
      File "C:\Users\GThell\Pillow\setup.py", line 778, in <module>
        zip_safe=not debug_build(), )
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\site-packages\setuptools\command\develop.py", line 34, in run
        self.install_for_development()
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\site-packages\setuptools\command\develop.py", line 119, in install_for_development
        self.run_command('build_ext')
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\users\gthell\appdata\local\programs\python\python36\lib\distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "C:\Users\GThell\Pillow\setup.py", line 549, in build_extensions
        raise RequiredDependencyException(f)
    __main__.RequiredDependencyException: zlib

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\GThell\Pillow\setup.py", line 790, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:

    The headers or library files could not be found for zlib,
    a required dependency when compiling Pillow from source.

    Please see the install instructions at:
       http://pillow.readthedocs.io/en/latest/installation.html
3
  • You could use the Anaconda distribution of Python instead? I've saved so much time trying to install packages that are usually a pain to get installed on Windows. After installing Anaconda just do conda install pillow and done! You'll probably want to uninstall your current version of Python first though but not necessary.
    – pbreach
    Commented Dec 16, 2016 at 16:53
  • I'm new to all of this. I'm teaching myself python so I can learn more about deep learning/ Machine learning and become a data scientist. Thank for recommend me Anaconda.
    – GTHell
    Commented Dec 17, 2016 at 7:58
  • 2
    If you can find any way to use Linux instead of Windows for Python, do it. Installing and maintaining python on Windows is sheer hell.
    – JonathanZ
    Commented Jan 26, 2017 at 2:52

8 Answers 8

11

use:

easy_install pillow

pip doesn't work somehow

0
8

I have recently installed Pillow under Cygwin's Python3.6 and needed following packages:

  • gcc-core
  • libjpeg-devel
  • zlib-devel
  • python3-devel
  • python3-setuptools (to run easy-install-3.6)

I have also installed pip using:

easy-install-3.6 install pip

Then finally:

pip3 install pillow

succeeded.

1
  • Thank you for this solution. It also worked for me with Python2.7 under Cygwin. Same steps, just install python2-devel and python2-setuptools. Commented Jan 5, 2019 at 13:45
5

As per the docs:

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow

You may need to substitute python3 for py, py3 or python, depending on your install.

Using plain old pip install Pillow doesn't work for me, nor does easy_install Pillow, which complains that it cannot be safely installed by EasyInstall.

4
pip install wheel
pip install Pillow

Worked for me

0
2

The URL at bottom of error message says:

Windows Installation We provide Pillow binaries for Windows compiled for the matrix of supported Pythons in both 32 and 64-bit versions in wheel, egg, and executable installers. These binaries have all of the optional libraries included:

pip install Pillow

I would try that, to avoid dependency problems such as you have run into.

edit: The pillow only support Pillow >= 2.0.0 < 3.5.0 and not 3.6.0

edit: Hopefully this work, I was not able to actually test on Windows.

4
  • I have try that 'pip install Pillow' but it still give me the same error message of zlib: self.build_extensions() File "C:\Users\GThell\AppData\Local\Temp\pip-build-y8vx01vv\Pillow\setup.py", line 521, in build_extensions ' using --disable-%s, aborting' % (f, f)) ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting
    – GTHell
    Commented Dec 16, 2016 at 16:53
  • Have you checked your python version for compatibility? "Pillow >= 3.5.0 supports Python versions 2.7, 3.3, 3.4, 3.5" (3.6 is not listed, which could be a problem) pillow.readthedocs.io/en/latest/installation.html Commented Dec 16, 2016 at 16:57
  • Aha, I didn't know that python is different from one version to another. Mine is 3.6.0. All I need to do is unistall python or just download the 3.5.0? Thank,
    – GTHell
    Commented Dec 17, 2016 at 0:03
  • I would probably uninstall the 3.6 because the latest stable release is actually 3.5.2 :) Commented Dec 17, 2016 at 0:58
1

On Windows, you're better off using precompiled binaries (wheels) than building from source.

Python 3.6.0 final is due out later this week on 2016-12-23 and Pillow does not yet support it. Hopefully it will be supported for the next quarterly release, on 1 January 2017.

However, in the meantime, you can download an unofficial wheel from here, then pip install filename.whl

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow

0
1

You can try installing Pillow with its Windows Installer package.
Check https://pypi.org/project/Pillow/#files, Windows Installer packages are at the bottom of the page.
Worked for me with Python 3.7.

1
  • OMG Thank you so much! I was in an endless loop of "can't install x cause of y, can't install y cause of z, can't install z cause of aa" and this finally solved my problem.
    – mauve
    Commented Sep 24, 2019 at 17:31
0

In windows, some packages wont work due to framework issues .same can be download and use it via 3rd party site.

Unofficial python Binaries

chose corresponding version download the same.

and then for eg,

pip install Downloads\\Pillow.whl

now it will install without error

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.