Skip to content

Fix outdated upgrade recommendation syntax #13518

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/13429.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use consistent ``python -m pip`` syntax across all platforms for upgrade recommendations instead of platform-specific commands.
9 changes: 3 additions & 6 deletions src/pip/_internal/self_outdated_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -136,10 +134,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(
Expand Down
Loading