pip
pip copied to clipboard
Wrong info message shown for installation from URL
Description
Pip gives the wrong error message "pip is looking at multiple versions of <package>" when a package is installed via a wheel file on the local file system or at a URL.
Expected behavior
The message "pip is looking at multiple versions of <package>" makes no sense, given the command issued. Pip should not state that it is looking at multiple versions of django in the example below.
pip version
24.2
Python version
3.12
OS
macOS
How to Reproduce
- Download a wheel file with dependencies, e.g.
curl https://files.pythonhosted.org/packages/28/b4/110532cebfea2244d76119904da98c6fa045ebb202aee9ec7cbf36ea3cad/Django-5.1-py3-none-any.whl -o Django-5.1-py3-none-any.whl - Disable your internet connection.
pip install Django-5.1-py3-none-any.whl --no-cache
Output
$ pip install Django-5.1-py3-none-any.whl --no-cache
Processing ./Django-5.1-py3-none-any.whl
[…]
INFO: pip is looking at multiple versions of django to determine which version is compatible with other requirements. This could take a while.
[…]
Code of Conduct
- [X] I agree to follow the PSF Code of Conduct.
I can reproduce this, but it seems like a bit of an edge case, I get a lot of connection errors first:
$ pip install Django-5.1-py3-none-any.whl --no-cache --dry-run
Processing ./Django-5.1-py3-none-any.whl
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fd5736dad50>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/asgiref/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fd573fe9df0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/asgiref/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fd573520680>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/asgiref/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fd57350ac60>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/asgiref/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fd5735208c0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/asgiref/
INFO: pip is looking at multiple versions of django to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement asgiref<4,>=3.8.1 (from django) (from versions: none)
ERROR: No matching distribution found for asgiref<4,>=3.8.1
I've not looked at the code flow, but I assume because asgiref can't be found the resolution algorithm backtracks on to django and looks for other versions to see if they don't have a dependency on asgiref, after not finding one a resolution error is thrown.
Maybe pip could exit early on the network errors. Or the wording of the error could be improved to account for the fact that pip isn't necessarily "looking at multiple versions" but "looking for other versions".
Pip is not meant to look for other versions of django here, and I don't think pip does. In my view, the whole message should just not be printed, regardless of the wording. (And it should not "take a while" because there is nothing to be done.)
If a clear improvement can made here I'm sure a PR would be accepted.