Search code examples
python-2.7pippyautogui

Getting "encoding' is an invalid keyword argument for this function" On Installing pyautogui via PIP


I'm getting this error when I'm trying to install "pyautogui" library to python. Please find the details below -

ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "################\pip-install-pmckiy\pygetwindow\setup.py", line 10, in <module>
with open('README.md', 'r', encoding='utf-8') as fh:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in c:\################\pip-install-pmckiy\pygetwindow\

Python Version - 2.7.12

Things I have already tried -

1.) I have upgraded the pip, current version - pip 19.1.1

2.) I also followed the steps as given in this another answer

"pip install unroll": "python setup.py egg_info" failed with error code 1

3.) Since this is installation I have no control over the code, also I tried to search for this error in the files but no luck, hence below URL also did not help me much -

Is 'encoding is an invalid keyword' error inevitable in python 2.x?

4.) I tried installing setuptools as well but it is also not helping


Solution

  • This is a bug in pygetwindow, already reported but not resolved: https://github.com/asweigart/PyGetWindow/issues/9

    The problem is that in Python 3 open has parameter encoding, but not in Python 2. That is, the code now requires Python 3.