diff --git a/crates/uv/src/commands/python/install.rs b/crates/uv/src/commands/python/install.rs index 480731cbe3586..33ed48c3d525c 100644 --- a/crates/uv/src/commands/python/install.rs +++ b/crates/uv/src/commands/python/install.rs @@ -306,7 +306,10 @@ pub(crate) async fn install( PythonUpgrade::Enabled(PythonUpgradeSource::Upgrade) => { writeln!( printer.stderr(), - "There are no installed versions to upgrade" + "No managed Python installations found\n\n{}{} Use `{}` to install a new Python version", + "hint".bold().cyan(), + ":".bold(), + "uv python install".green() )?; } PythonUpgrade::Enabled(PythonUpgradeSource::Install) => { @@ -615,15 +618,6 @@ pub(crate) async fn install( "Python is already installed. Use `uv python install ` to install another version.", )?; } - } else if matches!( - upgrade, - PythonUpgrade::Enabled(PythonUpgradeSource::Upgrade) - ) && requests.is_empty() - { - writeln!( - printer.stderr(), - "There are no installed versions to upgrade" - )?; } else if let [request] = requests.as_slice() { // Convert to the inner request let request = &request.request; diff --git a/crates/uv/tests/it/python_upgrade.rs b/crates/uv/tests/it/python_upgrade.rs index 108af424336a6..27ea140d41f0d 100644 --- a/crates/uv/tests/it/python_upgrade.rs +++ b/crates/uv/tests/it/python_upgrade.rs @@ -106,7 +106,9 @@ fn python_upgrade_without_version() { ----- stdout ----- ----- stderr ----- - There are no installed versions to upgrade + No managed Python installations found + + hint: Use `uv python install` to install a new Python version "); // Install earlier patch versions for different minor versions