From 159f7359fc9ad75da134162282bb3514347def97 Mon Sep 17 00:00:00 2001 From: CodeAgentCN <1152837612@qq.com> Date: Sun, 24 May 2026 18:43:55 +0800 Subject: [PATCH] fix(env): add --system flag to uv pip install for environments without virtualenv Fixes PrimeIntellect-ai/community-environments#455 When `prime env install` runs `uv pip install` outside a virtualenv, uv refuses with: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment Adding --system allows the install to succeed when no venv exists. --- packages/prime/src/prime_cli/commands/env.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/prime/src/prime_cli/commands/env.py b/packages/prime/src/prime_cli/commands/env.py index e3bf0a971..8e92f3f94 100644 --- a/packages/prime/src/prime_cli/commands/env.py +++ b/packages/prime/src/prime_cli/commands/env.py @@ -2040,6 +2040,7 @@ def get_install_command( # Use -P to only upgrade this package, not its dependencies cmd.extend(["-P", package_name]) cmd.append(wheel_url) + cmd.append("--system") return cmd elif tool == "pip": cmd = ["pip", "install"] @@ -2500,6 +2501,7 @@ def install( # Use -P to only upgrade this package, not its dependencies cmd_parts.extend(["-P", normalized_name]) cmd_parts.append(str(wheel_path)) + cmd_parts.append("--system") if prerelease: cmd_parts.append("--prerelease=allow") else: @@ -3204,6 +3206,7 @@ def _build_install_command( # Add URL dependencies as direct requirements (uv requires this) if url_dependencies: cmd.extend(url_dependencies) + cmd.append("--system") cmd.extend(["--extra-index-url", simple_index_url]) # Hub simple index doesn't emit PEP 700 upload-time metadata, so any # exclude-newer cutoff on the consumer side filters hub wheels @@ -3281,6 +3284,7 @@ def _install_single_environment(env_slug: str, tool: str = "uv", prerelease: boo cmd_parts = _uv_pip_command("install", "-P", normalized_name, str(wheel_path)) if prerelease: cmd_parts.append("--prerelease=allow") + cmd_parts.append("--system") else: cmd_parts = ["pip", "install", "--upgrade", str(wheel_path)] if prerelease: