How to Install Code-Graph-RAG with uv: A Complete Setup Guide

To install code-graph-rag with uv, run uv tool install "code-graph-rag[treesitter-full,semantic]" after installing system dependencies (cmake and ripgrep), then verify with cgr doctor and start the backend with cgr daemon up.

Code-graph-rag is an open-source tool that parses multi-language codebases using Tree-sitter, stores extracted AST data in a Memgraph knowledge graph, and provides an interactive CLI for natural-language querying. Installing code-graph-rag with uv ensures a reproducible environment with automatic Python 3.12+ management and dependency resolution.

Prerequisites

Before running the installation commands, ensure your system meets the requirements documented in docs/getting-started/installation.md (lines 9-15). According to the source code analysis, you need:

  • Python 3.12+: The wheel is pure-Python and requires at least version 3.12
  • Docker and Docker-Compose: Required for the bundled Memgraph and Qdrant container stack
  • System build tools: cmake (for compiling the pymgclient dependency) and ripgrep (for fast source searching)

Step-by-Step Installation with uv

Step 1: Install System Dependencies

First, install the native libraries required by the Python dependencies. The pymgclient package needs cmake to compile native extensions, while the CLI uses ripgrep for codebase indexing.


# macOS

brew install cmake ripgrep

# Ubuntu/Debian

sudo apt-get update && sudo apt-get install -y cmake ripgrep

Step 2: Install the uv Package Manager

If you do not have uv installed, use the official installer. Uv functions as both a Python version manager and package installer, capable of creating isolated virtual environments automatically.

curl -LsSf https://astral.sh/uv/install.sh | sh

Step 3: Install Code-Graph-RAG with Extras

The recommended installation command, referenced in lines 99-102 of both README.md and docs/getting-started/installation.md, pulls the package from PyPI with full language support and semantic search capabilities:

uv tool install "code-graph-rag[treesitter-full,semantic]"

This command resolves the optional extras defined in pyproject.toml, installing Tree-sitter parsers for multiple languages and Qdrant vector search integration. The cgr CLI entry-point is automatically placed on your PATH via the implementation in codebase_rag/cli.py.

To install the latest development version from the main branch instead of PyPI:

uv tool install "code-graph-rag[treesitter-full,semantic] @ git+https://github.com/vitali87/code-graph-rag@main"

Step 4: Verify the Installation

Run the built-in health check to confirm that Docker, Memgraph, and all Python dependencies are functional:

cgr doctor

This command validates that the two-component architecture (CLI client and backend knowledge graph) can communicate properly.

Step 5: Start the Backend Services

Launch the Memgraph and Qdrant containers using the bundled docker-compose configuration:

cgr daemon up

The CLI automatically connects to these services on the default ports, enabling the knowledge graph backend required for code analysis.

Understanding the Optional Extras

The pyproject.toml file defines several optional dependency groups that uv resolves during installation:

  • treesitter-full: Installs Tree-sitter language parsers for comprehensive multi-language AST parsing
  • semantic: Enables Qdrant vector database integration for semantic code similarity search
  • cpp: Adds compiler-backed C/C++ fact extraction (install with "code-graph-rag[treesitter-full,semantic,cpp]")

Summary

  • Install system prerequisites cmake and ripgrep before attempting the uv installation
  • Use uv tool install "code-graph-rag[treesitter-full,semantic]" to install with full language support and semantic search
  • Verify functionality with cgr doctor, which checks Docker, Memgraph, and Python dependency connectivity
  • Launch the required backend services with cgr daemon up to enable the knowledge graph database
  • Consult docs/getting-started/installation.md for troubleshooting and platform-specific guidance

Frequently Asked Questions

What Python version is required to install code-graph-rag with uv?

Code-graph-rag requires Python 3.12 or newer. When you run the uv tool install command, uv automatically creates an isolated environment with the correct Python version, eliminating manual version management.

Why does the installation require cmake and ripgrep system packages?

The pymgclient dependency requires cmake to compile native C extensions that communicate with the Memgraph database. The ripgrep binary enables high-performance source code searching within the CLI. These requirements are documented in docs/getting-started/installation.md lines 9-15 and are mandatory for full functionality.

How do I install code-graph-rag with C and C++ language support?

Append the cpp extra to include compiler-backed fact extraction for C and C++ codebases. Run uv tool install "code-graph-rag[treesitter-full,semantic,cpp]" as specified in the installation guide. This installs additional dependencies for parsing C-family languages with compiler-accurate metadata.

Can I use pip instead of uv to install code-graph-rag?

While the repository documentation recommends uv for its speed and automatic environment isolation, you can use standard pip with pip install "code-graph-rag[treesitter-full,semantic]" inside a Python 3.12+ virtual environment. However, uv handles virtual environment creation and Python version enforcement automatically, making it the preferred method according to the docs/getting-started/installation.md guide.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →