-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip list
should not perform a self-update check
#11677
Comments
@kloczek does the |
Yes it helps however checking own version should not be part of the pip execution. |
BTW when |
Othr observation: just tested [tkloczko@devel-g2v SPECS]$ time pip install -U --dry-run pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /usr/lib/python3.8/site-packages (22.3.1)
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 0x7f4667176880>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
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 0x7f4667176b80>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
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 0x7f4667176d30>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
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 0x7f4667176f10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
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 0x7f4667123040>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
WARNING: There was an error checking the latest version of pip.
real 13m1.157s
user 0m0.578s
sys 0m0.132s |
Looks like even on |
This is a conscious design tradeoff, as we believe it is important to encourage users to upgrade to the latest pip version. |
pip
command checks availability of its new versionpip list
performs a self-update check
Well, there is a legitimate workable thing here: |
If every possible software woud be encouraging users to upgrade something on every possible sotware execution it would be nightmare .. especially on the systems which has no access to public network. Really such functionality does not make to much sense. I'm going to prepare patch which will completly remove that functionality. |
Before making comments like this, please understand the background. Pip is core to Python packaging, and as such, if people are using outdated copies of pip, they will not be able to use new standards around such things as distrbution formats, index metadata delivery, etc. This will delay the adoption of such standards, and ultimately hold back the Python packaging ecosystem. So it is important that people use the latest copy of pip, which is why we chose the trade-off that we did. While it's arguable that things have changed, and it is worthwhile to revisit the decision, negative comments like this don't really help the situation. Personally, I think our current behaviour is still justified, and the options we provide for people who want to opt out of the version check are sufficient. |
Even if it is arguable still it is design issue in Second issue is that it is not possible to stop checking version by pressing ctrl-c. |
I suppose that hardcoding checking version of the pip on every |
OK, I've locked this as it is quickly becoming a "my opinion is better than the opinion of people who wrote and maintain the tool" type discussion. If you wish to have such a discussion, please have it on a different forum, this issue tracker is not the correct place.
You're free to make choices that you like, but I will reiterate that Beyond that, please don't submit a PR with such a patch.
Nothing in pip is configured to suppress keyboard interrupts, especially within that logic. My network is a little too good to demonstrate this easily, so here's me doing a tiny patch to make it easier for me to demonstrate that: ❯ pip --version
pip 23.0.dev0 from /Users/pradyunsg/Developer/github/pip/src/pip (python 3.10)
❯ pwd
/Users/pradyunsg/Developer/github/pip
❯ git show HEAD --stat
commit c4566c6c828fa7b41f5656d30c6375a494d73ded (HEAD -> main, upstream/main, upstream/HEAD, origin/main, origin/HEAD)
Merge: 32634e589 dd70d4a3a
Author: Pradyun Gedam <pradyunsg@gmail.com>
Date: Tue Dec 20 13:29:00 2022 +0000
Merge pull request #11667 from edmorley/patch-1
Remove duplicate news entry for #11547
news/11547.bugfix.rst | 3 ---
1 file changed, 3 deletions(-)
❯ git diff
diff --git a/src/pip/_internal/self_outdated_check.py b/src/pip/_internal/self_outdated_check.py
index 9e2149c52..79f795c0f 100644
--- a/src/pip/_internal/self_outdated_check.py
+++ b/src/pip/_internal/self_outdated_check.py
@@ -232,6 +232,7 @@ def pip_self_version_check(session: PipSession, options: optparse.Values) -> Non
_get_current_remote_pip_version, session, options
),
)
+ import time; time.sleep(100)
if upgrade_prompt is not None:
logger.warning("[present-rich] %s", upgrade_prompt)
except Exception:
❯ pip list -vvv
[trimmed for posterity]
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Fetching project page and analyzing links: https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 200 20678
Updating cache with response from "https://pypi.org/simple/pip/"
etag object cached for 1209600 seconds
Caching due to etag
Fetched page https://pypi.org/simple/pip/ as application/vnd.pypi.simple.v1+json
Found link https://files.pythonhosted.org/packages/3d/9d/1e313763bdfb6a48977b65829c6ce2a43eaae29ea2f907c8bbef024a7219/pip-0.2.tar.gz (from https://pypi.org/simple/pip/), version: 0.2
Found link https://files.pythonhosted.org/packages/18/ad/c0fe6cdfe1643a19ef027c7168572dac6283b80a384ddf21b75b921877da/pip-0.2.1.tar.gz (from https://pypi.org/simple/pip/), version: 0.2.1
[manually trimmed a bunch of lines]
Found link https://files.pythonhosted.org/packages/09/bd/2410905c76ee14c62baf69e3f4aa780226c1bbfc9485731ad018e35b0cb5/pip-22.3.1-py3-none-any.whl (from https://pypi.org/simple/pip/) (requires-python:>=3.7), version: 22.3.1
Found link https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad92c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz (from https://pypi.org/simple/pip/) (requires-python:>=3.7), version: 22.3.1
Skipping link: not a file: https://pypi.org/simple/pip/
Given no hashes to check 207 links for project 'pip': discarding no candidates
Remote version of pip: 22.3.1
Local version of pip: 23.0.dev0
Was pip installed by pip? True
^CTraceback (most recent call last):
File "/Users/pradyunsg/Developer/github/pip/.venv/bin/pip", line 8, in <module>
sys.exit(main())
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/main.py", line 70, in main
return command.main(cmd_args)
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/base_command.py", line 101, in main
return self._main(args)
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/base_command.py", line 216, in _main
self.handle_pip_version_check(options)
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/req_command.py", line 190, in handle_pip_version_check
pip_self_version_check(session, options)
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/self_outdated_check.py", line 235, in pip_self_version_check
import time; time.sleep(100)
KeyboardInterrupt For other maintainers, here's some relevant links:
I'll leave this open since there's a legit improvement to be made here, as noted in #11677 (comment). I suggest we keep this locked for at least a day or so. Does that suggestion for a change seem reasonable? |
pip list
performs a self-update checkpip list
should not perform a self-update check
Unlocking after a grace period. |
Description
Running
pip
in env which is cu off from public network I found that on each execution it tries to check availability of its new version.It causes long freezing of pip command and atthe end it prints message
WARNING: There was an error checking the latest version of pip.
Expected behavior
IMO
pip
should only do what is specified in commad lie parameters and nothing more.pip version
22.3.1
Python version
3.8.16
OS
Linux x86/64
How to Reproduce
Run
pip list
in env which is cut off from access to the public network.Output
Example:
Code of Conduct
The text was updated successfully, but these errors were encountered: