0

due to network constraints and security constraints, I must use python 2.7.11, and thus a lot of python packages don't install correctly with pip install, since it downloads a version that was released years after the python version was released.

Is there a way to automatically download the last version of a package which was compatible with python 2.7.11 including all of its dependencies (which also have to be compatible with python 2.7.11) without having to manually check which versions download correctly?

For example, I'd like to do something like pip install pyautogui --py-version 2.7.11

  • Does this answer your question? [Install a module using pip for specific python version](https://stackoverflow.com/questions/10919569/install-a-module-using-pip-for-specific-python-version) – JRiggles Jun 12 '23 at 19:31
  • If a package doesn't [declare Python version compatibility](https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#python-requires) then there is no way to automatically determine it. Only manual checking and testing. `pyautogui` doesn't declare `python_requires`; even worse, there is [a bug report on this](https://github.com/asweigart/pyautogui/issues/701) and the author never replied, not even "please send a pull request"; the issue is still open. – phd Jun 12 '23 at 20:25
  • By looking at https://pypi.org/project/PyAutoGUI/#history I found that the last version supporting Python 2.7 is [0.9.53](https://pypi.org/project/PyAutoGUI/0.9.53/). – phd Jun 12 '23 at 20:25
  • @JRiggles and @phd thanks for the help, when i try using the command python2.7 it says that "python2.7" isn't recognized as an internal or external command, and when i try installing pyautogui==0.9.53 i get this error: `Command "python setup.py egg_info" failed with error code 1 in c:\users\user\appdata\local\temp\pip-build-ygjfjl\pyautogui` – ProjectFluffy Jun 13 '23 at 04:59
  • When packages incldude wheels, then an inperfect "workaround" can be to include `--only-binary :all:` to the `pip` command. That way you can avoid grabbing the latest (non-compatible) source distribution, but the latest version that actually has a py27 whl file available (and should therefore be compatible). This fails of course for the numerous packages that come as source only – FlyingTeller Jun 13 '23 at 06:17

0 Answers0