How do I install PIL/Pillow for Python 3.6?
Asked Answered
I

6

77

I have a script that requires PIL to run. Other than downgrading my Python, I couldn't find anyway to install PIL on my Python 3.6

Here are my attempts:

pip install pil
Collecting pil
  Could not find a version that satisfies the requirement pil (from versions: )
No matching distribution found for pil

pip install Pillow
Collecting Pillow
  Using cached Pillow-3.3.1.zip
Installing collected packages: Pillow
  Running setup.py install for Pillow ... error
    Complete output from command c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ABDULR~1\\AppData\\Local\\Temp\\pip-build-rez5zpri\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ABDULR~1\AppData\Local\Temp\pip-a5bugnjo-record\install-record.txt --single-version-externally-managed --compile:
    Single threaded build for windows
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\PIL
    copying PIL\......................
    ..................................
    ..................................
    running egg_info
    writing Pillow.egg-info\PKG-INFO
    writing dependency_links to Pillow.egg-info\dependency_links.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 files found matching '*.sh'
    no previously-included directories found matching 'docs\_static'
    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 'build_children.sh'
    warning: no previously-included files found matching 'tox.ini'
    warning: no previously-included files matching '.git*' found anywhere in distribution
    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'
    copying PIL\OleFileIO-README.md -> build\lib.win-amd64-3.6\PIL
    running build_ext
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\setup.py", line 753, in <module>
        zip_safe=not debug_build(), )
      File "c:\python\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\python\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\python\python36\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "c:\python\python36\lib\distutils\command\install.py", line 539, in run
        self.run_command('build')
      File "c:\python\python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\python\python36\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "c:\python\python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\python\python36\lib\distutils\command\build_ext.py", line 338, in run
        self.build_extensions()
      File "C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\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

    ----------------------------------------
Command "c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ABDULR~1\\AppData\\Local\\Temp\\pip-build-rez5zpri\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ABDULR~1\AppData\Local\Temp\pip-a5bugnjo-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\

Didn't know to add argument --disable-zlib, pip install Pillow --disable-zlib wasn't correct.

Couldn't find what matches my system here: https://pypi.python.org/pypi/Pillow/3.0.0

64-bit Windows 10 & Python 3.6

Incisor answered 27/8, 2016 at 10:13 Comment(0)
U
92

For python version 2.x you can simply use

  • pip install pillow

But for python version 3.X you need to specify

  • pip3 install pillow
Unicorn answered 27/8, 2016 at 10:26 Comment(6)
I get the same error (about zlib being missing) with pip3 install pillow. How do I add --disable-zlib to the command? Or better install zlib. I am not sure if my script requires zlibIncisor
This is not really an answer to this specific question. It's clear from the question that the OP is using pip under Python 3.6.Barathea
pip install pillow works for me on python 3.5. So the answer is really not to the point. One reason could be to do a pip upgrade and try.pip install --upgrade pip and then try installing the pillow moduleSarnen
the uniformisation of the code from pip library works fine. You don't need to specify if your environment is in 3.X or in 2.X. The pip command works fine for both if you use the 'pip' commandProphylaxis
I've been prgramming in python for about 2 years; always in Python 3. I'll swear I've never used "pip3".Cart
On Windows 10, for Python 3.x you will need to Open and Run your CMD prompt as Administrator before running pip3 install pillow with your targeted version of Python 3.x. This is for those with more than one version of Python installed.Tinned
M
5

You can download the wheel corresponding to your configuration here ("Pillow‑4.1.1‑cp36‑cp36m‑win_amd64.whl" in your case) and install it with:

pip install some-package.whl

If you have problem to install the wheel read this answer

Malcommalcontent answered 16/5, 2017 at 9:24 Comment(0)
M
2

Pillow is released with installation wheels on Windows:

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

https://pillow.readthedocs.io/en/3.3.x/installation.html#basic-installation

Update: Python 3.6 is now supported by Pillow. Install with pip install pillow and check https://pillow.readthedocs.io/en/latest/installation.html for more information.


However, Python 3.6 is still in alpha and not officially supported yet, although the tests do all pass for the nightly Python builds (currently 3.6a4).

https://travis-ci.org/python-pillow/Pillow/jobs/155605577

If it's somehow possible to install the 3.5 wheel for 3.6, that's your best bet. Otherwise, zlib notwithstanding, you'll need to build from source, requiring an MS Visual C++ compiler, and which isn't straightforward. For tips see:

https://pillow.readthedocs.io/en/3.3.x/installation.html#building-from-source

And also see how it's built for Windows on AppVeyor CI (but not yet 3.5 or 3.6):

https://github.com/python-pillow/Pillow/tree/master/winbuild

Failing that, downgrade to Python 3.5 or wait until 3.6 is supported by Pillow, probably closer to the 3.6's official release.

Maddiemadding answered 28/8, 2016 at 5:38 Comment(0)
T
0

In Windows 10 for those struggling to install PIL/pillow while coding on PyCharm and have Python 3.10.6 proceed as follows;

  1. Close PyCharm IDE Open and Run CMD.exe prompt as Administrator
  2. In CMD prompt, run pip3 install pillow
  3. After pillow is installed, close CMD prompt
  4. Open PyCharm IDE and you will see that you can now import PIL
Tinned answered 5/12, 2022 at 10:41 Comment(0)
B
0

You might need to check the version:

  • pillow==4.0.0 added support for Python 3.6 (source)
  • pillow==9.0.0 dropped support for Python 3.6 (source)

So the latest version is pillow 8.4.0

pip install pillow==8.4.0

Additional dependencies

You might see something like:

main.RequiredDependencyException: jpeg

Then you need to install additional dependencies: https://pillow.readthedocs.io/en/stable/installation.html

On my Ubuntu system, I needed:

sudo apt install libjpeg-dev zlib1g-dev

According to https://mcmap.net/q/136246/-fail-during-installation-of-pillow-python-module-in-linux this might cover your case as well.

Biggs answered 27/8, 2023 at 5:22 Comment(0)
D
0

It is possible to install Pillow from PyCharm. You can install any version of PIL(Pillow) from 1.0 to 10.3.0. Use the Packages node. For a detailed description try this link.enter link description here

Diez answered 9/6, 2024 at 21:6 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.