fix(env): add --system flag to uv pip install for environments without virtualenv#680
Open
CodeAgentCN wants to merge 1 commit into
Open
Conversation
…t 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes PrimeIntellect-ai/community-environments#455
When running
prime env install <owner>/<env-name>outside a virtualenv,uv pip installfails with:This happens because uv, unlike pip, requires an explicit flag to install outside a virtualenv.
Solution
Added
--systemflag to all fouruv pip installcode paths in theenv.pyinstall functions:get_install_command()- used for wheel-based installs_install_single_environment()private env wheel path - used for private environment builds_build_install_command()- used for indexed environment installsinstall()command private env wheel path - used in the multi-env install flowThis allows
prime env installto work in environments without a pre-existing virtualenv. When a virtualenv is already active,--systemis a no-op (uv detects the venv and uses it).Related
--systemflag mentioned in CodeAgentCN's commentNote
Low Risk
Low risk: only adjusts generated
uv pip installcommand args to support system installs; behavior for existing virtualenv users should remain effectively unchanged.Overview
Fixes
prime env installwhen run outside a virtualenv by appending--systemto alluv pip installcommand paths (wheel URL installs, simple-index installs, and private-env wheel installs in both single- and multi-env flows). Pip-based install commands are unchanged.Reviewed by Cursor Bugbot for commit 159f735. Bugbot is set up for automated code reviews on this repo. Configure here.