GraphRAG

raw JSON →
3.0.9 verified Fri May 01 auth: no python

GraphRAG is a graph-based retrieval-augmented generation (RAG) system by Microsoft. The current version is 3.0.9, with frequent patch releases. Requires Python >=3.11, <3.14.

pip install graphrag
error ModuleNotFoundError: No module named 'graphrag'
cause The library is not installed or Python environment is wrong.
fix
Run pip install graphrag and ensure you are using Python >=3.11.
error AttributeError: module 'graphrag' has no attribute 'Indexer'
cause Import path changed in v3.0.0; Indexer is now in graphrag.index.
fix
Use from graphrag.index import Indexer instead of from graphrag import Indexer.
error OSError: [Errno 2] No such file or directory: 'config.yaml'
cause Missing configuration file; GraphRAG requires a config file to run indexing or queries.
fix
Run graphrag init --force in your project directory to create default config.yaml.
error ValueError: Unknown embedding model: ...
cause The embedding model specified in config is not recognized or not installed.
fix
Check the 'embedding.model' field in config.yaml and ensure you have the correct model name (e.g., text-embedding-ada-002).
breaking v3.0.0 introduced a monorepo restructure: many import paths changed. Use `from graphrag.index` instead of `from graphrag`. Old imports will break.
fix Update imports to match new package structure (e.g., graphrag.index, graphrag.query, graphrag.cache, etc.)
deprecated The `QueryEngine` from `graphrag.query_engine` has been moved to `graphrag.query`. The old path may be removed in a future release.
fix Use `from graphrag.query import QueryEngine`
gotcha The `litellm` dependency was compromised in the past; GraphRAG pins a specific safe version. Do not upgrade litellm independently.
fix Keep litellm pinned via GraphRAG's requirements; do not override.
breaking Python 3.13 support was added in v3.0.2, but v3.0.0-v3.0.1 did not support it. Python 3.11 is the minimum.
fix Upgrade to v3.0.2+ for Python 3.13 compatibility.
gotcha The `graphrag init --force` command is required to reinitialize config after upgrading to v3.0.0; otherwise configs may be incompatible.
fix Run `graphrag init --force` after upgrading to regenerate config.

Minimal import and setup for GraphRAG. Note: Full indexing requires a config file and data directory; run `graphrag init --force` first.

import os
os.environ.pop("OPENAI_API_KEY", None)  # placeholder; set your key via env var
from graphrag.index import Indexer
from graphrag.query import QueryEngine
# Index documents (requires a data directory and config)
# Run: graphrag init --force to create default config
print("GraphRAG ready")