mem0ai/mem0 · critical · ImportError
The 'chromadb' library is required. Please install it using
Error message
The 'chromadb' library is required. Please install it using 'pip install chromadb'.
What it means
ImportError raised at class-definition time in ChromaDbConfig: the module body tries 'from chromadb.api.client import Client' and if chromadb is not installed the config class itself fails to import. This is a hard dependency gate, not a runtime validation — you cannot even construct the config without the package.
Source
Thrown at mem0/configs/vector_stores/chroma.py:10
from typing import Any, ClassVar, Dict, Optional
from pydantic import BaseModel, ConfigDict, Field, model_validator
class ChromaDbConfig(BaseModel):
try:
from chromadb.api.client import Client
except ImportError:
raise ImportError("The 'chromadb' library is required. Please install it using 'pip install chromadb'.")
Client: ClassVar[type] = Client
collection_name: str = Field("mem0", description="Default name for the collection/database")
client: Optional[Client] = Field(None, description="Existing ChromaDB client instance")
path: Optional[str] = Field(None, description="Path to the database directory")
host: Optional[str] = Field(None, description="Database connection remote host")
port: Optional[int] = Field(None, description="Database connection remote port")
# ChromaDB Cloud configuration
api_key: Optional[str] = Field(None, description="ChromaDB Cloud API key")
tenant: Optional[str] = Field(None, description="ChromaDB Cloud tenant ID")
@model_validator(mode="before")
def check_connection_config(cls, values):
host, port, path = values.get("host"), values.get("port"), values.get("path")
api_key, tenant = values.get("api_key"), values.get("tenant")
# Check if cloud configuration is provided
cloud_config = bool(api_key and tenant)View on GitHub (pinned to 001c235229)
Solutions
- Install chromadb into the same environment running mem0: pip install chromadb
- If using extras, install mem0ai with the appropriate vector-store extra for chroma
- Verify with 'python -c "import chromadb"' in the exact interpreter/venv the app uses
- If the import fails despite installation, reinstall chromadb to repair a partial/corrupted install
Example fix
# before
pip install mem0ai
# then Memory.from_config({"vector_store": {"provider": "chroma", ...}}) -> ImportError
# after
pip install mem0ai chromadb Defensive patterns
Strategy: try-catch
Validate before calling
import importlib.util
if importlib.util.find_spec("chromadb") is None:
raise RuntimeError("chromadb is required for the chroma vector store: pip install chromadb") Try / catch
try:
from mem0.configs.vector_stores.chroma import ChromaDbConfig
except ImportError as e:
if "chromadb" in str(e):
# install chromadb or fall back to another vector store provider
... Prevention
- Declare chromadb in the same requirements/env spec as mem0 when using the chroma provider
- Add a dependency preflight (find_spec) before selecting the provider at runtime
- Verify installs in the exact interpreter the app runs under
When it happens
Trigger: Using the chroma vector store (Memory with vector_store.provider='chroma') in an environment where the chromadb package is missing, or installed in a different interpreter/venv than the one running mem0. Because it executes at import of mem0.configs.vector_stores.chroma, the failure can surface when mem0 lazily loads the vector store module.
Common situations: Installing mem0ai without vector-store extras and then selecting chroma; deploying to a slim Docker image that pruned 'unused' deps; a broken chromadb install (partial wheel) that makes the submodule import fail; multiple virtualenvs where the app runs in the one without chromadb.
Related errors
- The 'chromadb' library is required. Please install it using
- Either ChromaDB Cloud configuration (api_key, tenant) or loc
- Cannot specify both cloud configuration and local configurat
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- The 'upstash_vector' library is required. Please install it
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/d54cd99caab82715.
Report an issue: GitHub.