{"record":{"id":"91a81294d4ae511d","repo":"chroma-core/chroma","slug":"the-nomic-python-package-is-not-installed-please","errorCode":null,"errorMessage":"The nomic python package is not installed. Please install it with `pip install nomic`","messagePattern":"The nomic python package is not installed\\. Please install it with `pip install nomic`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/nomic_embedding_function.py","lineNumber":43,"sourceCode":"        task_type: str,\n        query_config: Optional[NomicQueryConfig],\n        api_key_env_var: str = \"NOMIC_API_KEY\",\n    ):\n        \"\"\"\n        Initialize the NomicEmbeddingFunction.\n\n        Args:\n            model (str): The name of the model to use for text embeddings.\n            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\n            query_config (Optional[NomicQueryConfig]): The configuration for setting task type for queries\n            api_key_env_var (str): The environment variable name for the Nomic API key. Defaults to \"NOMIC_API_KEY\".\n\n            Supported task types: search_document, search_query, classification, clustering\n        \"\"\"\n        try:\n            from nomic import embed\n        except ImportError:\n            raise ValueError(\n                \"The nomic python package is not installed. Please install it with `pip install nomic`\"\n            )\n\n        self.model = model\n        self.task_type = task_type\n        self.api_key_env_var = api_key_env_var\n        self.api_key = os.getenv(api_key_env_var)\n        self.query_config = query_config\n        if not self.api_key:\n            raise ValueError(f\"The {api_key_env_var} environment variable is not set.\")\n        self.embed = embed\n\n    def __call__(self, input: Documents) -> Embeddings:\n        if not all(isinstance(item, str) for item in input):\n            raise ValueError(\"Nomic only supports text documents, not images\")\n        output = self.embed.text(\n            model=self.model,\n            texts=input,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/nomic_embedding_function.py#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["pip install nomic","Verify import and key together: python -c \"import os; from nomic import embed; assert os.getenv('NOMIC_API_KEY')\"","Pin nomic and export NOMIC_API_KEY in deployment envs (the next constructor check requires it)"],"exampleFix":"# before\nfrom chromadb.utils.embedding_functions import NomicEmbeddingFunction\nef = NomicEmbeddingFunction(model=\"nomic-embed-text-v1.5\", task_type=\"search_document\")  # ValueError\n\n# after\n# pip install nomic && export NOMIC_API_KEY=...\nimport importlib.util, os\nif importlib.util.find_spec(\"nomic\") is None:\n    raise SystemExit(\"pip install nomic\")\nassert os.getenv(\"NOMIC_API_KEY\"), \"NOMIC_API_KEY missing\"\nef = NomicEmbeddingFunction(model=\"nomic-embed-text-v1.5\", task_type=\"search_document\")","handlingStrategy":"validation","validationCode":"import importlib.util, os\n\nif importlib.util.find_spec(\"nomic\") is None:\n    raise SystemExit(\"Nomic EF needs: pip install nomic\")\nif not os.getenv(\"NOMIC_API_KEY\"):\n    raise SystemExit(\"Nomic EF needs: export NOMIC_API_KEY=...\")\n\nfrom chromadb.utils.embedding_functions import NomicEmbeddingFunction\nef = NomicEmbeddingFunction(model=\"nomic-embed-text-v1.5\", task_type=\"search_document\")","typeGuard":null,"tryCatchPattern":"try:\n    ef = NomicEmbeddingFunction(model=\"nomic-embed-text-v1.5\", task_type=\"search_document\")\nexcept ValueError as e:\n    if \"nomic\" in str(e):\n        raise RuntimeError(\"pip install nomic\") from e\n    if \"environment variable is not set\" in str(e):\n        raise RuntimeError(\"export NOMIC_API_KEY before construction\") from e\n    raise","preventionTips":["Install and configure both prerequisites together: the nomic package and NOMIC_API_KEY","Pin nomic in the lockfile and re-verify after dependency syncs","Startup preflight: find_spec('nomic') plus env var assertion before serving"],"tags":["python","dependency","pip","nomic","optional-import"],"backgroundTag":"missing-optional-dependency","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}