Import pautogui and KeyError: ‘display’

I have an app that runs fine in local host but when deploying I get error message

2021-12-15 01:22:56.871 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py”, line 354, in _run_script
exec(code, module.dict)
File “/app/staygreen/main.py”, line 28, in
import pyautogui as gui
File “/home/appuser/venv/lib/python3.7/site-packages/pyautogui/init.py”, line 249, in
import mouseinfo
File “/home/appuser/venv/lib/python3.7/site-packages/mouseinfo/init.py”, line 223, in
_display = Display(os.environ[‘DISPLAY’])
File “/usr/local/lib/python3.7/os.py”, line 681, in getitem
raise KeyError(key) from None
KeyError: ‘DISPLAY’

Thanks for the help!