From 92802df223c8e6d8cfa64b2397bb0ae948a94985 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 13 Jun 2024 17:43:31 -0400 Subject: [PATCH] Suggest correct command to create a virtual environment when encountering externally managed interpreters (#4314) --- crates/uv/src/commands/pip/install.rs | 4 ++-- crates/uv/src/commands/pip/sync.rs | 4 ++-- crates/uv/src/commands/pip/uninstall.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/uv/src/commands/pip/install.rs b/crates/uv/src/commands/pip/install.rs index 12603bb81..3d7b23eba 100644 --- a/crates/uv/src/commands/pip/install.rs +++ b/crates/uv/src/commands/pip/install.rs @@ -159,13 +159,13 @@ pub(crate) async fn pip_install( } else { return if let Some(error) = externally_managed.into_error() { Err(anyhow::anyhow!( - "The interpreter at {} is externally managed, and indicates the following:\n\n{}\n\nConsider creating a virtual environment with `uv environment`.", + "The interpreter at {} is externally managed, and indicates the following:\n\n{}\n\nConsider creating a virtual environment with `uv venv`.", environment.root().user_display().cyan(), textwrap::indent(&error, " ").green(), )) } else { Err(anyhow::anyhow!( - "The interpreter at {} is externally managed. Instead, create a virtual environment with `uv environment`.", + "The interpreter at {} is externally managed. Instead, create a virtual environment with `uv venv`.", environment.root().user_display().cyan() )) }; diff --git a/crates/uv/src/commands/pip/sync.rs b/crates/uv/src/commands/pip/sync.rs index 945ae2998..51beb5b2a 100644 --- a/crates/uv/src/commands/pip/sync.rs +++ b/crates/uv/src/commands/pip/sync.rs @@ -154,13 +154,13 @@ pub(crate) async fn pip_sync( } else { return if let Some(error) = externally_managed.into_error() { Err(anyhow::anyhow!( - "The interpreter at {} is externally managed, and indicates the following:\n\n{}\n\nConsider creating a virtual environment with `uv environment`.", + "The interpreter at {} is externally managed, and indicates the following:\n\n{}\n\nConsider creating a virtual environment with `uv venv`.", environment.root().user_display().cyan(), textwrap::indent(&error, " ").green(), )) } else { Err(anyhow::anyhow!( - "The interpreter at {} is externally managed. Instead, create a virtual environment with `uv environment`.", + "The interpreter at {} is externally managed. Instead, create a virtual environment with `uv venv`.", environment.root().user_display().cyan() )) }; diff --git a/crates/uv/src/commands/pip/uninstall.rs b/crates/uv/src/commands/pip/uninstall.rs index 3aa5d4665..a0dffdc05 100644 --- a/crates/uv/src/commands/pip/uninstall.rs +++ b/crates/uv/src/commands/pip/uninstall.rs @@ -90,13 +90,13 @@ pub(crate) async fn pip_uninstall( } else { return if let Some(error) = externally_managed.into_error() { Err(anyhow::anyhow!( - "The interpreter at {} is externally managed, and indicates the following:\n\n{}\n\nConsider creating a virtual environment with `uv environment`.", + "The interpreter at {} is externally managed, and indicates the following:\n\n{}\n\nConsider creating a virtual environment with `uv venv`.", environment.root().user_display().cyan(), textwrap::indent(&error, " ").green(), )) } else { Err(anyhow::anyhow!( - "The interpreter at {} is externally managed. Instead, create a virtual environment with `uv environment`.", + "The interpreter at {} is externally managed. Instead, create a virtual environment with `uv venv`.", environment.root().user_display().cyan() )) };