chroma-core/chroma · error · ValueError

The langchain_core python package is not installed. Please i

Error message

The langchain_core python package is not installed. Please install it with `pip install langchain-core`

What it means

ChromaLangchainEmbeddingFunction.__init__ imports langchain_core.embeddings to obtain the Embeddings interface used for the isinstance check; on ImportError it raises ValueError suggesting `pip install langchain-core`. langchain-core is an optional dependency — chromadb only requires it for this bridge adapter.

Source

Thrown at chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py:46

class ChromaLangchainEmbeddingFunction(EmbeddingFunction[Embeddable]):
    """
    This class is used as bridge between langchain embedding functions and custom chroma embedding functions.
    """

    def __init__(self, embedding_function: Any) -> None:
        """
        Initialize the ChromaLangchainEmbeddingFunction

        Args:
            embedding_function: The embedding function implementing Embeddings from langchain_core.
        """
        try:
            import langchain_core.embeddings

            LangchainEmbeddings = langchain_core.embeddings.Embeddings
        except ImportError:
            raise ValueError(
                "The langchain_core python package is not installed. Please install it with `pip install langchain-core`"
            )

        if not isinstance(embedding_function, LangchainEmbeddings):
            raise ValueError(
                "The embedding_function must implement the Embeddings interface from langchain_core."
            )

        self.embedding_function = embedding_function

        # Store the class name for serialization
        self._embedding_function_class = embedding_function.__class__.__name__

    def embed_documents(self, documents: Sequence[str]) -> List[List[float]]:
        """
        Embed documents using the langchain embedding function.

        Args:

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. pip install langchain-core in the running environment.
  2. Add langchain-core (and your provider package, e.g. langchain-openai) to pinned project dependencies.
  3. If pip says it is installed, check `python -c "import langchain_core"` in the exact interpreter to rule out shadowing or a broken install.

Example fix

# before
from chromadb.utils.embedding_functions import create_langchain_embedding
ef = create_langchain_embedding(my_fn)  # ValueError: langchain_core not installed

# after (pip install langchain-core)
from langchain_openai import OpenAIEmbeddings
ef = create_langchain_embedding(OpenAIEmbeddings(model="text-embedding-3-large"))
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

if importlib.util.find_spec("langchain_core") is None:
    raise SystemExit("langchain-core required: pip install langchain-core")
ef = create_langchain_embedding(my_embeddings)

Try / catch

try:
    ef = create_langchain_embedding(my_embeddings)
except ValueError as e:
    if "langchain_core" in str(e):
        raise SystemExit("Install langchain-core (pip install langchain-core)") from e
    raise

Prevention

When it happens

Trigger: Constructing ChromaLangchainEmbeddingFunction(embedding_function) or calling create_langchain_embedding(fn) where langchain_core is not importable in the current interpreter.

Common situations: Environments that installed only langchain-community or a full langchain meta-package version that dropped langchain-core; fresh venvs with just chromadb; prod images trimmed of optional deps.

Related errors


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