chroma-core/chroma · error · ValueError

The nomic python package is not installed. Please install it

Error message

The nomic python package is not installed. Please install it with `pip install nomic`

What it means

NomicEmbeddingFunction lazily imports nomic.embed in __init__ and converts ImportError into this ValueError. The nomic package is an optional chromadb dependency required both for the client wrapper and for its local/API embedding machinery; construction fails before any embedding call. Immediately after this import the constructor also requires a NOMIC_API_KEY env var, so both must be in place.

Source

Thrown at chromadb/utils/embedding_functions/nomic_embedding_function.py:43

        task_type: str,
        query_config: Optional[NomicQueryConfig],
        api_key_env_var: str = "NOMIC_API_KEY",
    ):
        """
        Initialize the NomicEmbeddingFunction.

        Args:
            model (str): The name of the model to use for text embeddings.
            task_type (str): The type of task to embed with. See reference https://docs.nomic.ai/platform/embeddings-and-retrieval/text-embedding#embedding-task-types
            query_config (Optional[NomicQueryConfig]): The configuration for setting task type for queries
            api_key_env_var (str): The environment variable name for the Nomic API key. Defaults to "NOMIC_API_KEY".

            Supported task types: search_document, search_query, classification, clustering
        """
        try:
            from nomic import embed
        except ImportError:
            raise ValueError(
                "The nomic python package is not installed. Please install it with `pip install nomic`"
            )

        self.model = model
        self.task_type = task_type
        self.api_key_env_var = api_key_env_var
        self.api_key = os.getenv(api_key_env_var)
        self.query_config = query_config
        if not self.api_key:
            raise ValueError(f"The {api_key_env_var} environment variable is not set.")
        self.embed = embed

    def __call__(self, input: Documents) -> Embeddings:
        if not all(isinstance(item, str) for item in input):
            raise ValueError("Nomic only supports text documents, not images")
        output = self.embed.text(
            model=self.model,
            texts=input,

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. pip install nomic
  2. Verify import and key together: python -c "import os; from nomic import embed; assert os.getenv('NOMIC_API_KEY')"
  3. Pin nomic and export NOMIC_API_KEY in deployment envs (the next constructor check requires it)

Example fix

# before
from chromadb.utils.embedding_functions import NomicEmbeddingFunction
ef = NomicEmbeddingFunction(model="nomic-embed-text-v1.5", task_type="search_document")  # ValueError

# after
# pip install nomic && export NOMIC_API_KEY=...
import importlib.util, os
if importlib.util.find_spec("nomic") is None:
    raise SystemExit("pip install nomic")
assert os.getenv("NOMIC_API_KEY"), "NOMIC_API_KEY missing"
ef = NomicEmbeddingFunction(model="nomic-embed-text-v1.5", task_type="search_document")
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util, os

if importlib.util.find_spec("nomic") is None:
    raise SystemExit("Nomic EF needs: pip install nomic")
if not os.getenv("NOMIC_API_KEY"):
    raise SystemExit("Nomic EF needs: export NOMIC_API_KEY=...")

from chromadb.utils.embedding_functions import NomicEmbeddingFunction
ef = NomicEmbeddingFunction(model="nomic-embed-text-v1.5", task_type="search_document")

Try / catch

try:
    ef = NomicEmbeddingFunction(model="nomic-embed-text-v1.5", task_type="search_document")
except ValueError as e:
    if "nomic" in str(e):
        raise RuntimeError("pip install nomic") from e
    if "environment variable is not set" in str(e):
        raise RuntimeError("export NOMIC_API_KEY before construction") from e
    raise

Prevention

When it happens

Trigger: NomicEmbeddingFunction(model='nomic-embed-text-v1.5', task_type='search_query') in an env without the nomic package; fresh chromadb installs; nomic installed but broken by a conflicting version of its deps.

Common situations: Following Nomic ingestion examples on a bare chromadb install; team venvs created before the Nomic integration was added; pip resolver conflicts dropping nomic during sync.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/91a81294d4ae511d. Report an issue: GitHub.