How to Install Code-Graph-RAG with All Optional Extras: Complete Setup Guide

You can install Code-Graph-RAG with all optional extras by running pip install 'code-graph-rag[treesitter-full,semantic,cpp]' for PyPI-based setups, or uv sync --extra treesitter-full --extra semantic --extra cpp when building from the source repository.

Code-Graph-RAG is a knowledge graph-powered code analysis tool that supports multiple installation modes. When you install Code-Graph-RAG with all optional extras, you unlock multi-language parsing via Tree-sitter, semantic code search using UniXcoder embeddings, and compiler-backed C/C++ analysis. This guide walks through the complete setup process using both PyPI and source-based methods from the vitali87/code-graph-rag repository.

Prerequisites for Installing Code-Graph-RAG

Before you install Code-Graph-RAG with optional extras, ensure your system meets the foundational requirements. You need Python 3.12+, Docker and Docker-Compose, cmake, and ripgrep installed on your machine. These tools are essential for compiling the pymgclient dependency and running the Memgraph stack that powers the knowledge graph backend, as detailed in docs/getting-started/installation.md.

Installing Code-Graph-RAG with All Optional Extras

You have two primary paths to install Code-Graph-RAG: from PyPI for immediate use, or from source for development and deterministic builds.

PyPI Installation Method

The fastest way to install Code-Graph-RAG with all optional extras uses pip. This method pulls pre-built packages and automatically resolves the dependency tree defined in the [project.optional-dependencies] table of pyproject.toml.

pip install 'code-graph-rag[treesitter-full,semantic,cpp]'

This single command installs the core library plus all three optional dependency groups: treesitter-full, semantic, and cpp.

Source Installation with UV

For contributors or users requiring deterministic environments, clone the repository and use the uv package manager. This approach respects the lockfile and allows precise control over optional extras during the build process.

git clone https://github.com/vitali87/code-graph-rag.git
cd code-graph-rag
uv sync --extra treesitter-full --extra semantic --extra cpp

Understanding the Optional Extras Architecture

The optional extras are defined in pyproject.toml under the [project.optional-dependencies] table. Each extra activates specific capabilities while keeping the core installation lightweight:

  • treesitter-full: Installs Tree-sitter grammars for Python, JavaScript, TypeScript, Rust, Go, Scala, Java, C, C++, Lua, PHP, C#, Dart, SQL, and Markdown. This enables multi-language code parsing across your entire monorepo.
  • semantic: Adds Qdrant, torch, and transformers dependencies required for UniXcoder-based semantic embedding search and vector storage.
  • cpp: Installs libclang to enable compiler-backed C/C++ facts extraction. This feature requires a compile_commands.json file in your project root to access compiler internals.

Post-Installation Verification and Startup

After you install Code-Graph-RAG with all optional extras, initialize the runtime environment and verify that all components are properly connected.

Start the Memgraph Stack

Run the bundled Docker containers for Memgraph and Qdrant using the CLI implemented in codebase_rag/cli.py:

cgr daemon up

This command spins up the Memgraph database listening on port 7687 and Memgraph Lab on port 3000, alongside the Qdrant vector store required for semantic search.

Verify the Installation

Run the comprehensive health check to confirm all dependencies—including optional extras and Docker containers—are reachable:

cgr doctor

The cgr doctor command checks Python package imports, Docker container accessibility, and environment configuration to ensure your installation is production-ready.

Configure Environment Variables

Copy the example environment file and configure your API keys for cloud model providers:

cp .env.example .env

Edit .env to add authentication keys for Google Gemini, OpenAI, or configure endpoints for a local Ollama server. This configuration file is read by the CLI at runtime to determine which LLM backends to use for code analysis.

Summary

  • Install Code-Graph-RAG with all optional extras using either pip install 'code-graph-rag[treesitter-full,semantic,cpp]' (PyPI) or uv sync --extra treesitter-full --extra semantic --extra cpp (source)
  • Prerequisites include Python 3.12+, Docker, Docker-Compose, cmake, and ripgrep for successful compilation and runtime
  • The treesitter-full extra provides Tree-sitter grammars for 15+ languages, semantic enables Qdrant-based embedding search with PyTorch, and cpp adds libClang compiler integration
  • Use cgr daemon up to start the Memgraph and Qdrant stack, and cgr doctor to verify the complete installation
  • Configure API keys by copying .env.example to .env and editing the values for your preferred LLM providers

Frequently Asked Questions

What are the optional extras in Code-Graph-RAG?

The optional extras are dependency groups defined in the [project.optional-dependencies] section of pyproject.toml that extend core functionality without bloating the base installation. The treesitter-full extra adds Tree-sitter parsers for over 15 programming languages, semantic installs PyTorch, transformers, and Qdrant client libraries for UniXcoder-based code embeddings, and cpp includes libclang for extracting compiler-backed facts from C and C++ codebases.

Can I install Code-Graph-RAG without Docker?

You can install the Python package and CLI without Docker, but full functionality requires Docker to run the Memgraph graph database and Qdrant vector store. The cgr daemon up command automatically manages these containers, and the cgr doctor health check explicitly verifies Docker connectivity as part of its validation sequence implemented in codebase_rag/cli.py.

How do I verify that all optional extras are working correctly?

Run cgr doctor after installation to execute a comprehensive health check that verifies Python package imports for all optional extras, Docker container accessibility, and environment configuration. This command validates that Tree-sitter grammars, PyTorch/Transformers, and libclang (if installed) are properly importable and functional within the runtime environment.

What is the difference between installing from PyPI versus source?

PyPI installation provides the latest stable release with a simplified one-command setup using pip, ideal for end users who want to install Code-Graph-RAG with all optional extras quickly. Source installation using the uv package manager offers deterministic dependency resolution through a lockfile, making it the required method for contributing to the vitali87/code-graph-rag repository or testing development branches with specific dependency versions.

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 →