chroma-core/chroma · error · ValueError
The cohere python package is not installed. Please install i
Error message
The cohere python package is not installed. Please install it with `pip install cohere`
What it means
Chroma keeps provider SDKs optional; CohereEmbeddingFunction imports cohere lazily in __init__ and raises this ValueError when the import fails. Nothing about your Chroma usage or credentials is wrong - the constructor simply cannot build cohere.Client without the package.
Source
Thrown at chromadb/utils/embedding_functions/cohere_embedding_function.py:29
import numpy as np
from chromadb.utils.embedding_functions.schemas import validate_config_schema
import base64
import io
import importlib
import warnings
class CohereEmbeddingFunction(EmbeddingFunction[Embeddable]):
def __init__(
self,
api_key: Optional[str] = None,
model_name: str = "large",
api_key_env_var: str = "CHROMA_COHERE_API_KEY",
):
try:
import cohere
except ImportError:
raise ValueError(
"The cohere python package is not installed. Please install it with `pip install cohere`"
)
try:
self._PILImage = importlib.import_module("PIL.Image")
except ImportError:
raise ValueError(
"The PIL python package is not installed. Please install it with `pip install pillow`"
)
if api_key is not None:
warnings.warn(
"Direct api_key configuration will not be persisted. "
"Please use environment variables via api_key_env_var for persistent storage.",
DeprecationWarning,
)
if os.getenv("COHERE_API_KEY") is not None:
self.api_key_env_var = "COHERE_API_KEY"View on GitHub (pinned to aecdd12c8a)
Solutions
- pip install cohere in the environment that runs Chroma, then retry construction.
- Pin cohere in requirements.txt/pyproject.toml so installs stay reproducible.
- Verify with python -c 'import cohere' from the same interpreter you run Chroma with.
Example fix
# before from chromadb.utils.embedding_functions import CohereEmbeddingFunction ef = CohereEmbeddingFunction() # ValueError: cohere not installed # after # pip install cohere from chromadb.utils.embedding_functions import CohereEmbeddingFunction ef = CohereEmbeddingFunction(model_name='embed-english-v3.0')
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec('cohere') is None:
raise SystemExit('pip install cohere before using CohereEmbeddingFunction') Try / catch
try:
from chromadb.utils.embedding_functions import CohereEmbeddingFunction
ef = CohereEmbeddingFunction()
except ValueError as e:
if 'cohere' in str(e):
raise SystemExit(f'Dependency missing: {e}') from e
raise Prevention
- Pin cohere (and pillow) in the same manifest as chromadb.
- Smoke-test provider imports in CI using the production image.
- Check imports in the runtime interpreter, not your editor's venv.
When it happens
Trigger: CohereEmbeddingFunction(model_name=...) constructed in an interpreter where the cohere distribution is missing - fresh venv, pruned container image, stale lockfile.
Common situations: A teammate adds the Cohere embedding function without updating requirements; CI cache built before cohere was needed; different venv between IDE and runtime.
Related errors
- The PIL python package is not installed. Please install it w
- The httpx python package is not installed. Please install it
- Input must be a list of text documents (str) or a list of im
- The model name cannot be changed after the embedding functio
- The fastembed python package is not installed. Please instal
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/791d1d156c1a0539.
Report an issue: GitHub.