asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.24k forks source link

dependency issues with python 3.8 #696

Closed luisignaciomenendez closed 2 years ago

luisignaciomenendez commented 2 years ago

I am unable to install pyautogui within a conda environment using python 3.8.12

I pip installed it outside this environment and everything seems to work fine. However, within the environment, when I import it into python I receive the following error:

Traceback (most recent call last):
  File "/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/pyautogui/_pyautogui_osx.py", line 5, in <module>
    import Quartz
  File "/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/Quartz/__init__.py", line 110, in <module>
    _load()
  File "/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/Quartz/__init__.py", line 28, in _load
    from Quartz import CoreGraphics as m
  File "/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/Quartz/CoreGraphics/__init__.py", line 13, in <module>
    from Quartz.CoreGraphics._inlines import _inline_list_
ImportError: dlopen(/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/Quartz/CoreGraphics/_inlines.abi3.so, 0x0002): tried: '/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/Quartz/CoreGraphics/_inlines.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_inlines.abi3.so' (no such file), '/usr/lib/_inlines.abi3.so' (no such file)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/pyautogui/__init__.py", line 544, in <module>
    from . import _pyautogui_osx as platformModule
  File "/Users/luisignaciomenendezgarcia/tensorflow-test/env/lib/python3.8/site-packages/pyautogui/_pyautogui_osx.py", line 7, in <module>
    assert False, "You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html"
AssertionError: You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html

I tried to pip install pyobjc-core and pyobjc but it stays the same.

JayRizzo commented 2 years ago

Hi @luisignaciomenendez,

if you have both versions of python on your machine, open your terminal try this:

pip3 install pyobjc --upgrade
pip3 install pyobjc-core --upgrade
pip3 install pyautogui --upgrade

Hope it helps! Have a Great Day!

luisignaciomenendez commented 2 years ago

That did it indeed! Thank you so much :)