From 9a13924cdaf0e3c18b3678315aa30c765444255c Mon Sep 17 00:00:00 2001 From: Quaylyn Rimer Date: Fri, 1 Aug 2025 01:23:03 -0600 Subject: [PATCH 1/3] Fix outdated upgrade recommendation syntax Use consistent python -m pip syntax across all platforms instead of platform-specific pip3 command. This provides more reliable upgrade instructions that work across different Python installations. Fixes #13429 --- src/pip/_internal/self_outdated_check.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pip/_internal/self_outdated_check.py b/src/pip/_internal/self_outdated_check.py index ca507f113a4..bfd00853416 100644 --- a/src/pip/_internal/self_outdated_check.py +++ b/src/pip/_internal/self_outdated_check.py @@ -136,10 +136,9 @@ class UpgradePrompt: new: str def __rich__(self) -> Group: - if WINDOWS: - pip_cmd = f"{get_best_invocation_for_this_python()} -m pip" - else: - pip_cmd = get_best_invocation_for_this_pip() + # Use consistent module-based invocation across all platforms + # This is more reliable than direct pip commands + pip_cmd = f"{get_best_invocation_for_this_python()} -m pip" notice = "[bold][[reset][blue]notice[reset][bold]][reset]" return Group( From 6f93ff02b2c46387d7125edcd29ffa1bf8c6ccce Mon Sep 17 00:00:00 2001 From: Quaylyn Rimer Date: Fri, 1 Aug 2025 14:08:36 -0600 Subject: [PATCH 2/3] Add news fragment and fix linting issues - Add news fragment for issue #13429 documenting the consistent python -m pip syntax change - Remove unused imports (WINDOWS, get_best_invocation_for_this_pip) as identified by ruff linter --- news/13429.bugfix.rst | 1 + src/pip/_internal/self_outdated_check.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 news/13429.bugfix.rst diff --git a/news/13429.bugfix.rst b/news/13429.bugfix.rst new file mode 100644 index 00000000000..01fd488317a --- /dev/null +++ b/news/13429.bugfix.rst @@ -0,0 +1 @@ +Use consistent ``python -m pip`` syntax across all platforms for upgrade recommendations instead of platform-specific commands. \ No newline at end of file diff --git a/src/pip/_internal/self_outdated_check.py b/src/pip/_internal/self_outdated_check.py index bfd00853416..5be37ab2858 100644 --- a/src/pip/_internal/self_outdated_check.py +++ b/src/pip/_internal/self_outdated_check.py @@ -22,9 +22,7 @@ from pip._internal.metadata import get_default_environment from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.network.session import PipSession -from pip._internal.utils.compat import WINDOWS from pip._internal.utils.entrypoints import ( - get_best_invocation_for_this_pip, get_best_invocation_for_this_python, ) from pip._internal.utils.filesystem import adjacent_tmp_file, check_path_owner, replace From 891418daddc0a0bf0ade558ffc07ec25359f6adf Mon Sep 17 00:00:00 2001 From: Quaylyn Rimer Date: Fri, 1 Aug 2025 14:13:16 -0600 Subject: [PATCH 3/3] Fix end-of-file newline in news fragment - Add proper newline at end of news/13429.bugfix.rst to satisfy pre-commit end-of-file-fixer hook --- news/13429.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/13429.bugfix.rst b/news/13429.bugfix.rst index 01fd488317a..3da7100817d 100644 --- a/news/13429.bugfix.rst +++ b/news/13429.bugfix.rst @@ -1 +1 @@ -Use consistent ``python -m pip`` syntax across all platforms for upgrade recommendations instead of platform-specific commands. \ No newline at end of file +Use consistent ``python -m pip`` syntax across all platforms for upgrade recommendations instead of platform-specific commands.