'Pyautogui and Pillow not functioning though up to date

I keep getting errors with my Python Script:

from PIL import Image
import pyautogui
#import time
#length 1550
#height 730
input("Start")
pyautogui.locateCenterOnScreen('PlayButton.png')
#time.wait(30)
input("Done")
#Stage 1

Here are the errors that get thrown when Thonny tries to execute the program:

Traceback (most recent call last):
  File "V:\Programming\Python\ForWindows\FortniteBattlePassAutomation\FortniteBattlePassAutomation.py", line 7, in <module>
    pyautogui.locateCenterOnScreen('PlayButton.png')
  File "C:\Users\myusername\AppData\Roaming\Python\Python37\site-packages\pyautogui\__init__.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\myusername\AppData\Roaming\Python\Python37\site-packages\pyautogui\__init__.py", line 207, in locateCenterOnScreen
    return pyscreeze.locateCenterOnScreen(*args, **kwargs)
  File "C:\Users\myusername\AppData\Roaming\Python\Python37\site-packages\pyscreeze\__init__.py", line 413, in locateCenterOnScreen
    coords = locateOnScreen(image, **kwargs)
  File "C:\Users\myusername\AppData\Roaming\Python\Python37\site-packages\pyscreeze\__init__.py", line 372, in locateOnScreen
    screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
  File "C:\Users\myusername\AppData\Roaming\Python\Python37\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.

When I try updating my packages with this:

py -m pip install Pillow --upgrade

I get this:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: Pillow in c:\users\myusername\appdata\roaming\python\python37\site-packages (9.0.1)
Package     Version
----------- -------
MouseInfo   0.1.3
Pillow      9.0.1
pip         22.0.4
PyAutoGUI   0.9.53
PyGetWindow 0.0.9
PyMsgBox    1.0.9
pyperclip   1.8.2
PyRect      0.2.0
PyScreeze   0.1.28
pytweening  1.0.4
setuptools  47.1.0

I usually don't look for help on stackoverflow because I know I'll usually forget about where I'd asked before I ever get an answer, and usually my post gets deleted for being to similar to another, but I am at my wits end. I am getting very frustrated. This is probably some simple fix I don't know about due to my own ignorance. This is my first time using Python on Windows as I usually use Linux.



Sources

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

Source: Stack Overflow

Solution Source