'Pyautogui error: The Pillow package is required to use this function

My pyautogui program gives me the following error when I do:

position = pyautogui.locateCenterOnScreen(image, confidence=.7)

Error message:

File "C:\Users\ashis\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 144, in wrapper
    raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.

Other pyautogui functions are working properly only when I do pyautogui.locateCenterOnScreen() gives and error.

I already have pillow properly installed:

Requirement already satisfied: pillow in c:\users\ashis\appdata\local\programs\python\python310\lib\site-packages (9.0.0)

Can anyone help please? I am following a tutorial.



Solution 1:[1]

That's a small problem, just update your Pillow package.

pip install Pillow --upgrade

Pillow-4.2.1 was on my system, it upgraded to Pillow-5.1.0 and now everything works just fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tanay