Code-Graph-RAG Prerequisites: Complete Installation Requirements Guide
To install Code-Graph-RAG, you need Python 3.12+, Docker with Docker-Compose, cmake and ripgrep build tools, and optionally cloud LLM API keys or a local Ollama instance.
Code-Graph-RAG is an open-source RAG-powered code analysis tool that combines graph databases with vector search. Understanding the prerequisites for installing Code-Graph-RAG ensures a smooth setup whether you're using cloud AI models or running everything locally. The following requirements are derived directly from the vitali87/code-graph-rag source code and installation documentation.
Python Runtime Requirements
Python 3.12 or Newer
The core CLI and SDK require Python 3.12+ as specified in pyproject.toml. This minimum version ensures compatibility with modern type hints, async features, and the latest library dependencies used throughout the codebase.
You can verify your Python version with:
python --version
If your system Python is older, use pyenv or a similar version manager to install Python 3.12 before proceeding.
Package Manager: uv (Recommended) or pip
The installation guide recommends uv for faster dependency resolution and isolated environments. Standard pip works as a fallback but may resolve dependencies more slowly.
Install uv:
pip install uv
Alternative: upgrade pip if sticking with the standard tool:
pip install --upgrade pip
System Build Tools
Two system-level tools are required before installing the Python package:
cmake
Required to compile pymgclient, the native C extension that enables Python communication with Memgraph. Install platform-specific versions:
macOS:
brew install cmake
Ubuntu/Debian:
sudo apt-get update && sudo apt-get install -y cmake
CentOS/RHEL:
sudo yum install -y cmake
ripgrep (rg)
Used by the CLI for fast source-code text searches—finding imports, detecting dead code, and other text-based analysis operations.
macOS:
brew install ripgrep
Ubuntu/Debian:
sudo apt-get install -y ripgrep
CentOS/RHEL:
sudo dnf install -y ripgrep
Container Platform: Docker and Docker-Compose
Code-Graph-RAG orchestrates two services via Docker containers:
- Memgraph: The primary graph database for storing code relationships
- Qdrant: Vector database for semantic search capabilities
Verify your installation:
docker --version
docker compose version
The cgr daemon up command (implemented in the CLI) pulls official images and starts both services. The Dockerfile in the repository root defines the custom image configuration for this stack.
AI Model Access (Choose Your Path)
The RAG assistant requires LLM access for natural-language-to-Cypher generation and code editing suggestions. You have two configuration options:
Option 1: Cloud LLM APIs
Set up API keys for one or both providers:
- Google Gemini
- OpenAI
These are stored in your .env file and read by python-dotenv at runtime.
Option 2: Local LLM with Ollama
For fully self-hosted operation, install and run Ollama with a compatible model. The CLI will query your local endpoint instead of cloud APIs.
No keys are required for this path, though local hardware must meet Ollama's model requirements.
Environment Configuration
After installing system tools, create your environment file from the provided template:
cp .env.example .env
Edit .env to include:
- Docker service configuration (ports, volumes)
- Memgraph connection parameters
- Cloud API keys (if using Gemini/OpenAI)
- Local model endpoint URL (if using Ollama)
The .env.example file in the repository root documents all available variables and their default values.
Installing Code-Graph-RAG
With prerequisites satisfied, install the package with optional extras:
# Recommended: uv with full language support and semantic search
uv tool install "code-graph-rag[treesitter-full,semantic]"
# Alternative: pipx with same feature set
pipx install "code-graph-rag[treesitter-full,semantic]"
The [treesitter-full] extra pulls complete Tree-sitter language grammars. The [semantic] extra enables vector-based semantic search via Qdrant. Both are declared in pyproject.toml as optional dependency groups.
Verification Steps
Bring up the infrastructure and verify everything works:
# Start Memgraph + Qdrant containers
cgr daemon up
# Run comprehensive health checks
cgr doctor
The cgr doctor command checks Python environment, Docker connectivity, Memgraph responsiveness, and AI model accessibility—reporting any missing prerequisites.
Key Configuration Files
| File | Purpose |
|---|---|
docs/getting-started/installation.md |
Complete OS-specific installation instructions |
.env.example |
Environment variable template for credentials and service URLs |
pyproject.toml |
Python version constraints and optional extras definitions |
Dockerfile |
Memgraph+Qdrant container image specification |
Summary
- Python 3.12+ is mandatory for core functionality
- Docker and Docker-Compose orchestrate Memgraph and Qdrant services
- cmake and ripgrep are required system build tools
- API keys or Ollama provide LLM access for RAG features
- uv package manager offers faster installation than pip
cgr doctorverifies your complete setup
Frequently Asked Questions
What Python versions are compatible with Code-Graph-RAG?
Code-Graph-RAG requires Python 3.12 or newer. Earlier versions lack support for specific type-hinting patterns and async features used in the codebase. The pyproject.toml explicitly declares this constraint in the requires-python field.
Can I run Code-Graph-RAG without Docker?
No. Docker is required because Memgraph and Qdrant run as containerized services. The cgr daemon up command manages these containers automatically. Running the databases natively is not supported by the project's tooling or documentation.
Do I need both Gemini and OpenAI API keys?
No. You need at least one cloud provider (Google Gemini or OpenAI) or a local Ollama instance. The CLI checks for available credentials in your .env file and falls back to the configured local endpoint if no cloud keys are present.
Is uv mandatory or can I use standard pip?
uv is recommended but not mandatory. The installation documentation presents uv first for its speed and environment isolation benefits. Standard pip or pipx installs work correctly if you prefer familiar tooling.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →