PIL.Image and PIL.ImageTk

Hi
The calibrate button for the image in the geoviewer in my FLAIR is inactive which alerted me to a warning that I ignored until then.

Started 2020.03.11 16:16:29
>w> Warning: PIL.Image and PIL.ImageTk not found

I checked for all the related python imaging packages and all seem to be the latest versions and in place.

FLAIR v 3.0-7 (last change Feb 25)
Updated using sudo apt update/upgrade on WSL Ubuntu 18.04 LTS.

What I am missing here?

Many thanks
Sunil

Dear Sunil,

can you confirm, that the python3-pil and python3-pil.imagetk packages are installed on you machine?

Cheers,
David

Dear David
Upon trying to install I see these messages
python3-pil is already the newest version (5.1.0-1ubuntu0.2).
python3-pil.imagetk is already the newest version (5.1.0-1ubuntu0.2).

Ciao

Sunil

Dear Sunil,

could you start an interactive python session with the command python3, and try to run the following commands:

import PIL.Image
import PIL.ImageTk

They shouldn’t return anything. If they give an error message, that means something wrong with your installation.

Cheers,
David

Dear David
Here is what I get.

$ import PIL.Image

Command ‘import’ not found, but can be installed with:

sudo apt install imagemagick-6.q16
sudo apt install graphicsmagick-imagemagick-compat
sudo apt install imagemagick-6.q16hdri

$ import PIL.ImageTk

Command ‘import’ not found, but can be installed with:

sudo apt install imagemagick-6.q16
sudo apt install graphicsmagick-imagemagick-compat
sudo apt install imagemagick-6.q16hdri

Cheers
-S

Hi Sunil,

first you need to start the python interactive session with:

python3

then you can run the import commands.

Cheers,
David

Dear David
@horvathd My apologies, you were right. It was giving me errors. what worked for me is

pip install Pillow

The errors are here, for the sake of completeness. Perhaps you can add that as a requirement for FLAIR installation.
Many thanks
Cheers
-S

    >>> import PIL.Image
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'PIL'

>>> import PIL.ImageTk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PIL'

Dear Sunil,

thank you, for you report.

python3-pil should provide Pillow on Ubuntu 18.04. I don’t know, why it wasn’t working on your machine.

Cheers,
David

Hi @sunil

it seems to me that there is some mixing of different python versions on your machine. Can you verify that the python3 you are running is the system one from /usr/bin/python3

Vasilis

Hi @vasilis
Quite astute observation!
Here are some outputs. May be I should do some spring cleaning.
Cheers.

$ /usr/bin/python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux

$ python
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux

$ python3
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux

$ gcc --version
gcc (Ubuntu 9.2.1-17ubuntu1~18.04.1) 9.2.1 20191102