Can't Install Pillow on Python 3.7.0a on Windows

I am using Python 3.7.0a2 and Django (2, 0, 2, 'final', 0) in Windows 10. while I was migrating my project I got the following error:

ERRORS:
accounts.UserProfile.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
        HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow".

Then I ran the 'pip install Pillow' command and I got the following error:

  Traceback (most recent call last):
    File "C:\Users\VIKASV~1\AppData\Local\Temp\pip-build-hfzb5tde\pillow\setup.py", line 792, in <module>
      zip_safe=not (debug_build() or PLATFORM_MINGW), )
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\site-packages\setuptools\command\install.py", line 61, in run
      return orig.install.run(self)
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\command\install.py", line 545, in run
      self.run_command('build')
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\users\vikas visking\appdata\local\programs\python\python37\lib\distutils\command\build_ext.py", line 339, in run
      self.build_extensions()
    File "C:\Users\VIKASV~1\AppData\Local\Temp\pip-build-hfzb5tde\pillow\setup.py", line 580, 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\VIKASV~1\AppData\Local\Temp\pip-build-hfzb5tde\pillow\setup.py", line 804, 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:
     https://pillow.readthedocs.io/en/latest/installation.html

How can I install Pillow?

Upvotes: 0

Views: 3670

Answers (5)

its30
its30

Reputation: 273

The pre-compiled versions of Pillow are available here, but not all versions are included.

As long as you make sure to use a version that has a precompiled binary (either as direct install or in a pip/peotry/etc dependency list), things will work.

Upvotes: 2

Viaches
Viaches

Reputation: 401

Maybe someone will be useful.

Only after I updated some packages to certain versions, I was able to install package Pillow (7.0.0) on virtual env.

I updated package setuptools to the latest version (on that moment, 44.0.0)

And updated package pip to 19.2.3.


for reference, I used: Python 3.8.0, Django 2.2.8, Virtualenv 16.7.9, Windows 10 SL x64

Upvotes: 0

Xiaoyan Zhuo
Xiaoyan Zhuo

Reputation: 132

For latest Anaconda with python3.7, pillow is available. Install it by using:

conda install pillow

After that, deactivate your current env, and activate env again, then it should work. (This step is important to make it effective)

Upvotes: 0

zmbq
zmbq

Reputation: 39013

Pillow needs to be compiled on Windows. pip install Pillow tries to use a precompiled version and if it fails - it tries to compile it locally.

You're using Python 3.7 which hasn't been released yet, I suspect the Pillow people have not prepared a precompiled binary for this.

Easiest solution would be to downgrade to Python 3.6. Otherwise, you'll need to install everything necessary to compile Pillow.

Upvotes: 0

inmate37
inmate37

Reputation: 1238

Try installing Pillow like below (If you are using Python3):

pip3 install pillow

And this: (If you are using Python2):

pip install pillow

Upvotes: 0

Related Questions