Minimal example:
pip install tensorflow==2.9.1 non-existing==1.2.3
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting tensorflow==2.9.1
Downloading tensorflow-2.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (511.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 511.7/511.7 MB 7.6 MB/s eta 0:00:00
ERROR: Could not find a version that satisfies the requirement non-existing==1.2.3 (from versions: none)
ERROR: No matching distribution found for non-existing==1.2.3
So pip downloads the (rather huge) TensorFlow first, only to then tell me that non-existing does not exist.
Is there a way to make it fail earlier, i.e., print the error and quit before downloading?