3

I want to install pillow, but when I run pip install pillow in the cmd I get the following message:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pillow
  Downloading https://files.pythonhosted.org/packages/5e/b6/8960697526a79bd1cb4520293078be3a10d725f23f20abbee298ebdeaabd/Pillow-6.2.2-cp27-cp27m-win_amd64.whl (1.9MB)
     |ERROR: Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence

WARNING: You are using pip version 19.2.3, however version 20.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Python 3.8.2 is already installed on my computer and I added it to PATH.

I also ran python -m pip install --upgrade pip and nothing has changed.

What is the problem? Do I need to update the Python version?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Shir Cohen
  • 41
  • 1
  • 1
  • 4
  • What operating system are you on? Have you tried `pip3 install pillow` or `python 3 -m pip install pillow`? (Side note: are you using a virtual environment? You _really_ should be. Don't pollute your global packages with `pip`-installed stuff.) – ChrisGPT was on strike May 04 '20 at 21:18
  • `pip` is for Python 2, `pip3` is for Python 3 – ForceBru May 04 '20 at 21:18
  • 4
    Not necessarily, @ForceBru. It depends how everything is set up. But that's likely the issue. – ChrisGPT was on strike May 04 '20 at 21:18
  • @Chris, OP's `pip` is trying to download `Pillow-6.2.2-cp27-cp27m-win_amd64.whl` (for CPython 2.7 on 64-bit Windows), so, given that they claim they've installed Python 3, there should be `pip3`, or at least `python3`. But that's Windows, so it could also be `py` – ForceBru May 04 '20 at 21:20
  • 3
    I'm just saying it's not a simple as "`pip` is for Python 2, `pip3` is for Python 3". Other users may find this question later. We don't want to mislead them if we can help it. – ChrisGPT was on strike May 04 '20 at 21:21
  • Just download the Python .exe installer from https://python.org and run it — don't use `pip`. – martineau May 04 '20 at 21:23
  • 1
    @Chris is right. The assumption that `pip` is for Python 2 and `pip3` is for Python 3 doesn't always hold. One could have multiple versions of Python 3 on the same system for instance, in a Python 3 virtual environment `pip` points obviously to a Python 3 interpreter (the one in the virtual environment), etc. So it is best to entirely avoid instructions such as `pip3 install Something`. – sinoroc May 05 '20 at 08:03
  • I tried to run this command `pip3 install pillow` and got `Successfully installed pillow-7.1.2 WARNING: You are using pip version 19.2.3, however version 20.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.` Why should I avoid this command? Do you know how to uninstall? – Shir Cohen May 05 '20 at 08:51
  • 2
    @ShirCohen What is it exactly that you are trying to do? You seem to have already installed Python 3.8.2, and now you want to install _Pilllow_ for _Python 3.8.2_, is that right? If yes then find out the exact path to the binary for the _Python 3.8.2_ interpreter and execute the following: `C:\path\to\python3.8.2\python.exe -m pip install Pillow`. Read my answer and the links in their entirety from top to bottom for more details. – sinoroc May 05 '20 at 09:25
  • Im trying to update python version. I downloaded Python 3.8.2, installed it in my computer and added it to PATH, but when I run `python --version` I get `Python 2.7.17`. I don't understand why. – Shir Cohen May 05 '20 at 10:06
  • Do you know how the `PATH` environment variable works? When you enter just `python`, meaning without any file path, then that `python` command is looked up in all the directories that are listed in `PATH`. The first match wins. So look at your `PATH` (for example call `echo %PATH%`) and then look in every single directory listed until you find one that has a `python.exe` (or `python.bat` or any other extension listed in `echo %PATHEXT%`). – sinoroc May 05 '20 at 14:17

4 Answers4

2

Installation using third party PPA repository

Step 1: First install the Ubuntu software properties package if it’s not already installed on your system.

$ sudo apt update

$ sudo apt install software-properties-common

Step 2: After that run the commands to add the PPA.

$ sudo add-apt-repository ppa:deadsnakes/ppa

Step 3: Finally, run below to install Python 3.8

$ sudo apt update
$ sudo apt install python3.8

You can check as below:

$ python3 --version

Python 3.8.1

OK done.

Syscall
  • 19,327
  • 10
  • 37
  • 52
0

Don't use the pip, pip3, etc. scripts ever. Instead always prefer the more explicit and surefire way of calling pip's executable module for a specific instance of the Python interpreter, for example:

path/to/pythonX.Y -m pip install Pillow

References:

sinoroc
  • 18,409
  • 2
  • 39
  • 70
-1
  1. Check if Python3 is correctly installed by, for example, running python3 -V in the command-line (this will show you the installed version)

    • This should show something like Python 3.8 ...
    • If you get an error here, like it is an unknown command, something probably went wrong during the installation...
  2. Run pip3 install pillow to install pillow (Python 3)

Ix76
  • 86
  • 7
-1

Kindly download it at Python official website.

There is an option to update your version during the installation which is very useful.

Comsavvy
  • 630
  • 9
  • 18