diff --git a/build/runner/src/pyenv.rs b/build/runner/src/pyenv.rs index f514096fb..9d65626ca 100644 --- a/build/runner/src/pyenv.rs +++ b/build/runner/src/pyenv.rs @@ -32,9 +32,17 @@ pub fn setup_pyenv(args: PyenvArgs) { } } + let mut command = Command::new(args.uv_bin); + + // remove UV_* environment variables to avoid interference + for (key, _) in std::env::vars() { + if key.starts_with("UV_") { + command.env_remove(key); + } + } + run_command( - Command::new(args.uv_bin) - .env_clear() + command .env("UV_PROJECT_ENVIRONMENT", args.pyenv_folder.clone()) .args(["sync", "--locked", "--no-config"]) .args(args.extra_args), diff --git a/qt/launcher/src/main.rs b/qt/launcher/src/main.rs index 34a81a622..15548d3bc 100644 --- a/qt/launcher/src/main.rs +++ b/qt/launcher/src/main.rs @@ -257,9 +257,16 @@ fn handle_version_install_or_update(state: &State, choice: MainMenuChoice) -> Re // Prepare to sync the venv let mut command = Command::new(&state.uv_path); + command.current_dir(&state.uv_install_root); + + // remove UV_* environment variables to avoid interference + for (key, _) in std::env::vars() { + if key.starts_with("UV_") { + command.env_remove(key); + } + } + command - .current_dir(&state.uv_install_root) - .env_clear() .env("UV_CACHE_DIR", &state.uv_cache_dir) .env("UV_PYTHON_INSTALL_DIR", &state.uv_python_install_dir) .args(["sync", "--upgrade", "--managed-python", "--no-config"]);