Score:1

How to install PIL or Pillow in Ubuntu 22.04?

cn flag

In Ubuntu 22.04, I discovered that the Python Image Library (PIL) or (Pillow) is preinstalled

$ pip3 list -v | grep Pillow
Pillow                  9.0.1           /usr/lib/python3/dist-packages

However, its latest version is 9.4.0 and I want to use that.

Should I do (1) or (2)?

  1. python3 -m pip install --upgrade Pillow
    
  2. python3 -m pip install --user Pillow
    

If --upgrade is used, it will upgrade Pilow. But I am concerned that it will cause conflict with other Ubuntu 22.04 system packages designed to use Pillow 9.0.1? (1) was given by Pillow.

If --user is used, I think it should install Pillow 9.4.0 in my local directory /home/user/.local/lib/python3.10/site-packages. Hence when I do import PIL in any python script, Pillow 9.4.0 should be called as a default.

Which option should I use?

PS. I am aware that there is a third option which is to create a virtual env for the script I am creating and to install Pillow 9.4.0 there. But I do not need to do this for a small script hence not considering this option.

Score:2
cn flag

Looks like option 2 won't work given that a Pillow package already exists or is installed. Option 1 is the way.

$ python3 -m pip install --user Pillow
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (9.0.1)
$ python3 -m pip install --upgrade Pillow
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (9.0.1)
Collecting Pillow
  Downloading Pillow-9.4.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 15.9 MB/s eta 0:00:00
Installing collected packages: Pillow
Successfully installed Pillow-9.4.0
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.