1

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.

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .