microsoft/autogen · critical · ImportError

ChromaDB embedding functions not available. Ensure chromadb

Error message

ChromaDB embedding functions not available. Ensure chromadb is properly installed.

What it means

ChromaDBVectorMemory creates its embedding function lazily via chromadb.utils.embedding_functions; if that submodule cannot be imported (broken/partial chromadb install or a version that moved it), this ImportError is raised with the original error chained.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/memory/chromadb/_chromadb.py:202

    @property
    def collection_name(self) -> str:
        """Get the name of the ChromaDB collection."""
        return self._config.collection_name

    def _create_embedding_function(self) -> Any:
        """Create an embedding function based on the configuration.

        Returns:
            A ChromaDB-compatible embedding function.

        Raises:
            ValueError: If the embedding function type is unsupported.
            ImportError: If required dependencies are not installed.
        """
        try:
            from chromadb.utils import embedding_functions
        except ImportError as e:
            raise ImportError(
                "ChromaDB embedding functions not available. Ensure chromadb is properly installed."
            ) from e

        config = self._config.embedding_function_config

        if isinstance(config, DefaultEmbeddingFunctionConfig):
            return embedding_functions.DefaultEmbeddingFunction()

        elif isinstance(config, SentenceTransformerEmbeddingFunctionConfig):
            try:
                return embedding_functions.SentenceTransformerEmbeddingFunction(model_name=config.model_name)
            except Exception as e:
                raise ImportError(
                    f"Failed to create SentenceTransformer embedding function with model '{config.model_name}'. "
                    f"Ensure sentence-transformers is installed and the model is available. Error: {e}"
                ) from e

        elif isinstance(config, OpenAIEmbeddingFunctionConfig):

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Reinstall chromadb cleanly: pip install --force-reinstall chromadb.
  2. Check the chained ImportError for the real missing module and install it (e.g. onnxruntime for DefaultEmbeddingFunction).
  3. Verify with python -c "from chromadb.utils import embedding_functions" and remove any local chromadb.py shadow file.
  4. Pin a known-good chromadb version compatible with your autogen-ext release.

Example fix

# shell
pip install --force-reinstall chromadb
python -c "from chromadb.utils import embedding_functions; print('ok')"
Defensive patterns

Strategy: validation

Validate before calling

try:
    from chromadb.utils import embedding_functions  # noqa: F401
except ImportError:
    raise SystemExit("chromadb install is broken; reinstall with: pip install --force-reinstall chromadb")

Try / catch

try:
    memory = ChromaDBVectorMemory(config=config)
    await memory.update_context(ctx)  # triggers lazy init
except ImportError as e:
    if "embedding functions not available" in str(e):
        # reinstall/repair chromadb, then retry
        raise SystemExit("Repair with: pip install --force-reinstall chromadb") from e
    raise

Prevention

When it happens

Trigger: Constructuring/initializing ChromaDBVectorMemory (first query or update triggers _create_embedding_function) when chromadb.utils.embedding_functions is missing or fails to import.

Common situations: Chromadb installed but corrupted or partially upgraded; incompatible chromadb version where the utils module moved; namespace-shadowing (a local chromadb.py file); missing transitive deps like onnxruntime for the default embedding function.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/bbd8b6a8108c03ce. Report an issue: GitHub.