Skip to content

Make install work on PEP 668 systems + fix venv MCP-server wiring#54

Merged
Neverdecel merged 2 commits into
masterfrom
claude/trusting-johnson-7vuowg
Jun 18, 2026
Merged

Make install work on PEP 668 systems + fix venv MCP-server wiring#54
Neverdecel merged 2 commits into
masterfrom
claude/trusting-johnson-7vuowg

Conversation

@Neverdecel

Copy link
Copy Markdown
Owner

Why

The flagship one-liner and Quick start used a global pip install, which fails with error: externally-managed-environment on Debian/Ubuntu and other PEP 668 systems — the most common Linux setup, so nearly every new user hits it. Working around it with a venv then exposed a second, quieter trap in coderag install.

What

1. Docs — README.md

  • Flagship one-liner now uses pipx, which installs CodeRAG into an isolated environment and puts coderag on PATH — exactly what an agent needs to launch the server. A blockquote covers installing pipx and the plain-pip + venv fallback for PEP 668.
  • Quick start now leads with python3 -m venv .venv && source .venv/bin/activate, plus a note on the coderag install activation footgun (below).

2. Fix — coderag/install.py (_server_invocation)

coderag install recorded a bare coderag mcp whenever coderag was on PATH at install time — including an activated virtualenv, whose bin/coderag disappears once deactivated. The agent then launches the server from its own shell and can't find coderag.

Now it writes a bare coderag only when it's durably on PATH: a non-venv (system/user) install, or a launcher outside the current venv prefix (e.g. a pipx shim in ~/.local/bin). Inside a venv it pins this interpreter's coderag console script by absolute path — looked up lexically in sys.executable's bin dir so a venv's python symlink isn't followed back to the base interpreter — falling back to <python> -m coderag.surfaces.cli mcp. pipx and system installs still get a clean bare coderag.

Tests

Adds coverage for each resolution case in tests/test_install.py: system install, activated venv, venv-not-activated, pipx shim outside the venv, and the module fallback.

  • pytest -m "not integration" — green (exit 0)
  • ruff check . / ruff format --check . — clean
  • mypy coderag — Success, no issues found in 40 source files

🤖 Generated with Claude Code

https://claude.ai/code/session_01F2K45QFkrJEACjmWPwUvqY


Generated by Claude Code

claude added 2 commits June 18, 2026 13:37
The flagship one-liner and Quick start both used a global `pip install`,
which fails with `externally-managed-environment` on Debian/Ubuntu and
other PEP 668 systems — the most common Linux setup.

- Flagship one-liner now uses pipx: it installs CodeRAG into an isolated
  environment and puts `coderag` on PATH, exactly what the agent needs to
  launch the MCP server. pip + venv shown as the alternative.
- Quick start now creates a virtual environment first, and notes the
  `coderag install` activation footgun: run it via `.venv/bin/coderag`
  so it records the venv's Python by absolute path rather than a bare
  `coderag` the agent can't resolve from a normal shell.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F2K45QFkrJEACjmWPwUvqY
`coderag install` recorded a bare `coderag mcp` whenever `coderag` was on
PATH at install time — including an *activated* virtualenv, whose
`bin/coderag` disappears once deactivated. The agent then launches the
server from its own shell and fails to find `coderag`.

`_server_invocation` now writes a bare `coderag` only when it is durably on
PATH: a non-venv (system/user) install, or a launcher outside the current
venv prefix (e.g. a pipx shim in ~/.local/bin). Inside a venv it pins this
interpreter's `coderag` console script by absolute path — looked up
lexically in sys.executable's bin dir so a venv's `python` symlink is not
followed back to the base interpreter — falling back to
`<python> -m coderag.surfaces.cli mcp`. pipx and system installs still get
a clean bare `coderag`.

Adds tests for each resolution case: system install, activated venv,
venv-not-activated, pipx shim outside the venv, and the module fallback.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F2K45QFkrJEACjmWPwUvqY
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Neverdecel Neverdecel merged commit 38a04f2 into master Jun 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants