Py-ser
Py-ser

Reputation: 2108

upgrade pillow suggested, but then already up-to-date

I am trying to fix a call to the Image module (I did not know about this Python imaging library until now), and I need to upgrade Pillow, because the file in /usr/lib/python3/dist-packages/PIL/Image.py states a version 1.1.7, but a more recent version is available.

$  sudo pip3 install Pillow
[sudo] password di user: 
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled.           

Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): Pillow in /usr/lib/python3/dist-packages
You are using pip version 8.1.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

You are using pip version 8.1.1, however version 19.2.1 is available.

But then, when I try to upgrade:

user:~/Downloads$ pip3 install --upgrade pip
Requirement already up-to-date: pip in /home/user/.local/lib/python3.7/site-packages (19.2.1)

I am confused, what am I missing?

Upvotes: 0

Views: 12188

Answers (2)

BPDESILVA
BPDESILVA

Reputation: 2198

Try

sudo -H pip3 install Pillow 

Also, you need to fix the permissions if you are going to do this as sudo

$ sudo chown -R USERNAME /Users/USERNAME/Library/Logs/pip
$ sudo chown -R USERNAME /Users/USERNAME/Library/Caches/pip

Note: It is not recommended to do any of these as the superuser.

Follow the documentation for best practices: https://pip.pypa.io/en/stable/reference/pip_install/

To upgrade packages in the future :

pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install -U

For older versions :

pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install -U

Simplified :

v2

$ pip install pip-review
$ pip-review --local --interactive

v3

$ pip3 install pip-review
$ py -3 -m pip_review --local --interactive

Another solution: https://github.com/achillesrasquinha/pipupgrade

Upvotes: 1

Hugo
Hugo

Reputation: 29354

The first message tells you there's an upgrade available for pip, not Pillow.

The first command uses sudo. The second one doesn't. You must have a different pip in the sudo path than in the user path.

It's not recommended to use sudo with pip. Instead use the --user switch.

Also, the 1.1.7 version in Image.py is the version of PIL, of which Pillow is a fork. Pillow itself has another version number, and the 1.1.7 version is being removed from Pillow.

So don't use sudo pip3 ... and instead:

pip3 install --user --upgrade pip
pip3 install --user --upgrade pillow

Upvotes: 5

Related Questions