Python 3.10 – 3.14 is required to run Cognee.
Setup Notes
Environment Configuration
Environment Configuration
- We recommend creating a
.envfile in your project root - Cognee supports many configuration options, and a
.envfile keeps them organized
API Keys & Models
API Keys & Models
You have two main options for configuring LLM and embedding providers:Option 1: OpenAI (Simplest)
- Single API key handles both LLM and embeddings
- Uses
openai/gpt-5.6-lunafor LLM andopenai/text-embedding-3-largefor embeddings by default - Works out of the box with minimal configuration
- Configure both LLM and embedding providers separately
- Supports Gemini, Anthropic, Ollama, and more
- Requires setting both
LLM_*andEMBEDDING_*variables
By default, Cognee uses OpenAI for both LLMs and embeddings. If you change the LLM provider but don’t configure embeddings, it will still default to OpenAI.
Virtual Environment
Virtual Environment
We recommend creating a virtual environment before installing Cognee. Use whichever tool you prefer — uv is fast, but the standard library If PowerShell blocks activation with an execution-policy error, or
venv works just as well if you don’t use uv.The activation command depends on your shell, not just your operating system. source is Unix-only; on Windows, PowerShell and Command Prompt each have their own activation script inside .venv\Scripts\.- macOS / Linux
- Windows (PowerShell)
- Windows (Command Prompt)
import cognee later fails because the wrong interpreter is active, see the Windows Setup accordion below.Download Size & Offline Installs
Download Size & Offline Installs
As of v1.6.0, Cognee wheels bundle the embedded graph engine’s JSON extension binaries, so the default graph store never has to download them at runtime and works on offline or firewall-restricted hosts. As of v1.6.1 the bundle also ships in the source distribution, so a wheel built from the sdist —
uv build, or any --no-binary install — carries it too. See Graph Stores for the two platforms the bundle does not cover.This makes the wheel noticeably larger — roughly 7 MB before bundling, and roughly 19 MB with the two engine versions currently bundled, almost all of the difference being the Windows binaries. The size tracks the graph engine version range in Cognee’s own dependencies, so it moves whenever that range does: each additional bundled version adds about 5 MB. The source distribution was unchanged in v1.6.0 and grows by roughly the same bundle from v1.6.1 on, and the Docker image grows by about 15 MB. Installing still needs network access for Cognee itself and its dependencies; only the extension download is removed.uv Projects (uv add)
uv Projects (uv add)
If your project is managed by uv — it has a Extras go in the package spec exactly as with pip. Quote it so your shell does not interpret the brackets:Then run your code with
pyproject.toml, usually created with uv init — use uv add instead of uv pip install. It records Cognee in your pyproject.toml dependencies, updates uv.lock, and installs it into the project’s .venv:uv run python your_script.py, which uses the project environment without manual activation.Two things to know:uv addrequires a uv project. Run from a directory with nopyproject.toml(a plainuv venvenvironment, for example), it fails — useuv pip install cogneethere instead.- Cognee requires Python
>=3.10,<3.15, so your project’s ownrequires-pythonmust stay inside that range or resolution fails.
Windows Setup
Windows Setup
On Windows the setup steps differ slightly from Linux/macOS.
Install uv
Install uv
Install uv with the official standalone installer, which adds uv to your
PATH automatically:- PowerShell
- Command Prompt (CMD)
Create and Activate the Virtual Environment
Create and Activate the Virtual Environment
Once If you see an execution-policy error, run this first (current user only):
uv --version works, create the environment and activate it with the script that matches your shell — PowerShell uses .venv\Scripts\Activate.ps1, Command Prompt uses .venv\Scripts\activate.bat:- PowerShell
- Command Prompt (CMD)
Verify the Python Interpreter
Verify the Python Interpreter
After installing Cognee in the Setup section, confirm the active interpreter can import it:The printed path should point inside your If it does not, re-activate the environment in that terminal:To bypass activation entirely, call the venv interpreter explicitly when running your script:In an IDE (VS Code, PyCharm), select the
- PowerShell
- Command Prompt (CMD)
.venv folder.A common Windows error is ModuleNotFoundError: No module named 'cognee' even though the install succeeded. This happens when the script runs with system Python instead of the venv interpreter — for example after opening a new terminal without re-activating, double-clicking a .py file, or an IDE configured to use the global interpreter.First confirm which Python the active terminal uses. The .venv\Scripts\python.exe path should be selected:- PowerShell
- Command Prompt (CMD)
- PowerShell
- Command Prompt (CMD)
- PowerShell
- Command Prompt (CMD)
.venv interpreter as the project interpreter so the Run button uses it.Configure Environment Files and Paths
Configure Environment Files and Paths
Copy the template from the project root, then open it in any text editor (Notepad, VS Code, etc.):Save the A If you prefer to set variables directly in your shell session instead of using a file:Python-dotenv handles both Windows (CRLF) and Unix (LF) line endings automatically, so line endings are not a concern.
- PowerShell
- Command Prompt (CMD)
.env file in your project root — the same directory from which you run Python. At import time Cognee runs its own search for the file: the working directory and its parents first, stopping at the project root (the nearest directory holding .git or pyproject.toml), then the installed package’s directory tree. Set COGNEE_ENV_FILE to pin a specific file instead. See How .env Is Loaded for the full resolution order.When setting DATA_ROOT_DIRECTORY or SYSTEM_ROOT_DIRECTORY in your .env file, use forward slashes or double backslashes — single backslashes are not valid in .env values:~ home-directory prefix also works and is cross-platform:- PowerShell
- Command Prompt (CMD)
Optional
Optional
Database
Database
- PostgreSQL database is required if you plan to use PostgreSQL as your relational database (requires
postgresextra)
Setup
- OpenAI (Recommended)
- Other Providers (Gemini, Anthropic, etc.)
- Ollama (Local, No API Key)
Environment: Add your OpenAI API key to your Installation: Install Cognee with the default package, using whichever tool manages your environment. With What this gives you: Cognee installed with default local databases (SQLite, LanceDB, Kuzu) — no external servers required.
.env file:pip or uv pip, activate the virtual environment first; in a uv project, uv add installs into the project’s .venv directly:This single API key handles both LLM and embeddings. The defaults are
openai/gpt-5.6-luna for the LLM and openai/text-embedding-3-large (3072 dimensions) for embeddings.Extras and Common Installation Combinations
Cognee’s base installation (pip install cognee) includes everything needed to run with OpenAI and the default local databases (SQLite, LanceDB, Kuzu). Optional extras unlock additional providers, integrations, and features.
Install one or more extras with:
uv pip install; the same package specs work with pip install and with uv add in a uv project (see the uv Projects note above).
Common installation combinations
Common installation combinations
If you already know the stack you want, these combinations cover the most common setups:
LLM & Embedding Providers
LLM & Embedding Providers
These extras install provider SDKs. You still need to set the corresponding environment variables. See LLM Providers and Embedding Providers.
There is no separate
gemini extra. Gemini through Google AI Studio is supported through litellm, which is already part of the base installation. Vertex AI for Gemini additionally requires google-cloud-aiplatform.Vector & Graph Stores
Vector & Graph Stores
Data Ingestion & Processing
Data Ingestion & Processing
Infrastructure & Storage
Infrastructure & Storage
Observability & Monitoring
Observability & Monitoring
Evaluation
Evaluation
Development & Tooling
Development & Tooling
Missing dependency errors (ImportError)
Missing dependency errors (ImportError)
If you encounter an
ImportError when using a cognee feature, it usually means a required extra has not been installed.Verifying Release Authenticity
Cognee’s release pipeline attaches supply-chain provenance to the packages it publishes: PEP 740 attestations shown in the “Provenance” section of the PyPI project page, plus a GitHub-hosted SLSA build provenance attestation. To confirm a downloaded wheel or sdist was built by CI fromtopoteretes/cognee:
Which projects this covers
Two PyPI projects are published from this repository, from separate workflows and with different provenance:cognee-mcp is uploaded with a PyPI API token rather than Trusted Publishing, so its files carry no PEP 740 attestations — there is no “Provenance” section on the cognee-mcp project page to check. The GitHub-hosted SLSA build provenance is still produced for every release the workflow publishes, so that half verifies normally — note the underscore in the distribution filename:
cognee-mcp 0.5.5 and earlier were uploaded by hand and carry no attestations at all, so verification has nothing to check for them. 0.5.6 was also uploaded by hand, but from the files CI built and attested, so the command above works for it. The subsection below applies to the cognee library only: MCP releases are published and tagged, but create no GitHub release.
Verifying from the GitHub release page
The release pipeline also attaches the built distributions and their attestation to the GitHub release for the tag, so you can verify without querying GitHub’s attestation store:
Point
gh attestation verify at the bundle instead of the repo:
X.Y.Z.devYYYYMMDD) create no GitHub release and have no assets to verify; .devN pre-releases cut from dev do get them.
Releases published before the provenance pipeline landed (August 2026) carry no attestations, so verification has nothing to check for them; releases cut before this asset upload landed have the attestations but no release-page assets, so use the --repo form above for those. For the full mechanism, see Supply-chain provenance & release attestations in the cognee repo.
Next Steps
Run Your First Example
Quickstart TutorialGet started with Cognee by running your first knowledge graph example.
Explore Advanced Features
Core ConceptsDive deeper into Cognee’s powerful features and capabilities.