I've been having some trouble with importing the pyAutoGUI package into a file for usage. I used
pip install pyautogui
to import the package at first. I did this on an Ubuntu terminal with a Windows OS, Windows 10 to the best of my knowledge. I've played around with adding sudo before the command to make
sudo pip install pyautogui
as well as adding the --user command to the end of the first iteration to make
pip install pyautogui --user.
Because of this, I have no reason to believe that the problem lies with user access.
The initial issue came with setting the display, which has been resolved but I feel relevant to bring up. Upon importing the pyautogui package into the bash terminal, the program would throw a KeyError due to the 'DISPLAY' variable. That said, that specific issue has been solved.
However, now when I try to import pyautogui, I get an error. Here is the verbatim console error:
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/pyautogui/__init__.py", line 249, in <module>
import mouseinfo
File "/home/<user>/.local/lib/python3.8/site-packages/mouseinfo/__init__.py", line 223, in <module>
_display = Display(os.environ['DISPLAY'])
File "/home/<user>/.local/lib/python3.8/site-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/home/paulflanagan/.local/lib/python3.8/site-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/home/<user>/.local/lib/python3.8/site-packages/Xlib/protocol/display.py", line 58, in __init__
self.socket = connect.get_socket(name, host, displayno)
File "/home/<user>/.local/lib/python3.8/site-packages/Xlib/support/connect.py", line 76, in get_socket
return mod.get_socket(dname, host, dno)
File "/home/<user>/.local/lib/python3.8/site-packages/Xlib/support/unix_connect.py", line 78, in get_socket
raise error.DisplayConnectionError(dname, str(val))
Xlib.error.DisplayConnectionError: Can't connect to display ":0": [Errno 2] No such file or directory```
Does anyone know how I could fix this issue?