SIGN IN SIGN UP

[Build] Implement install_requirements.sh with Python (#4748)

Move the details of install_requirements.sh into install_requirements.py. Then, call install_requirements.py from install_requirements.sh.

This will avoid duplication when adding Windows version of installing_requirements.

This is for issue #4661.

Release Note: Moved the main install_requirements.sh logic into install_requirements.py so that it can also run on Windows.

Test Plan:
Tested on a mac.

Ran `./install_requirements.sh --pybind xnnpack` under python 3.10, and it completed successfully. To make sure that xnnpack was actually installed, I manually ran the steps from the notebook at https://colab.research.google.com/drive/1qpxrXC3YdJQzly3mRg-4ayYiOjC6rue3, and it passed.

When running the same in a clean python 3.8 environment, it failed as expected with

```
% ./install_requirements.sh --pybind xnnpack
Collecting packaging
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Installing collected packages: packaging
Successfully installed packaging-24.1
ERROR: ExecuTorch does not support python version 3.8.19: must satisfy ">=3.10"
```

Also tested under WSL and native Windows.
X
Xiang Li committed
f887d7212e06cf9ecadfdb8e96bde2efa7144314
Parent: 1f783f5
Committed by GitHub <noreply@github.com> on 8/20/2024, 10:41:43 PM