{"record":{"id":"2fbd11b3abe8b362","repo":"chroma-core/chroma","slug":"the-langchain-core-python-package-is-not-installed","errorCode":null,"errorMessage":"The langchain_core python package is not installed. Please install it with `pip install langchain-core`","messagePattern":"The langchain_core python package is not installed\\. Please install it with `pip install langchain-core`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py","lineNumber":46,"sourceCode":"\nclass ChromaLangchainEmbeddingFunction(EmbeddingFunction[Embeddable]):\n    \"\"\"\n    This class is used as bridge between langchain embedding functions and custom chroma embedding functions.\n    \"\"\"\n\n    def __init__(self, embedding_function: Any) -> None:\n        \"\"\"\n        Initialize the ChromaLangchainEmbeddingFunction\n\n        Args:\n            embedding_function: The embedding function implementing Embeddings from langchain_core.\n        \"\"\"\n        try:\n            import langchain_core.embeddings\n\n            LangchainEmbeddings = langchain_core.embeddings.Embeddings\n        except ImportError:\n            raise ValueError(\n                \"The langchain_core python package is not installed. Please install it with `pip install langchain-core`\"\n            )\n\n        if not isinstance(embedding_function, LangchainEmbeddings):\n            raise ValueError(\n                \"The embedding_function must implement the Embeddings interface from langchain_core.\"\n            )\n\n        self.embedding_function = embedding_function\n\n        # Store the class name for serialization\n        self._embedding_function_class = embedding_function.__class__.__name__\n\n    def embed_documents(self, documents: Sequence[str]) -> List[List[float]]:\n        \"\"\"\n        Embed documents using the langchain embedding function.\n\n        Args:","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/chroma_langchain_embedding_function.py#L28-L64","documentation":"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.","triggerScenarios":"Constructing ChromaLangchainEmbeddingFunction(embedding_function) or calling create_langchain_embedding(fn) where langchain_core is not importable in the current interpreter.","commonSituations":"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.","solutions":["pip install langchain-core in the running environment.","Add langchain-core (and your provider package, e.g. langchain-openai) to pinned project dependencies.","If pip says it is installed, check `python -c \"import langchain_core\"` in the exact interpreter to rule out shadowing or a broken install."],"exampleFix":"# before\nfrom chromadb.utils.embedding_functions import create_langchain_embedding\nef = create_langchain_embedding(my_fn)  # ValueError: langchain_core not installed\n\n# after (pip install langchain-core)\nfrom langchain_openai import OpenAIEmbeddings\nef = create_langchain_embedding(OpenAIEmbeddings(model=\"text-embedding-3-large\"))","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"langchain_core\") is None:\n    raise SystemExit(\"langchain-core required: pip install langchain-core\")\nef = create_langchain_embedding(my_embeddings)","typeGuard":null,"tryCatchPattern":"try:\n    ef = create_langchain_embedding(my_embeddings)\nexcept ValueError as e:\n    if \"langchain_core\" in str(e):\n        raise SystemExit(\"Install langchain-core (pip install langchain-core)\") from e\n    raise","preventionTips":["Pin langchain-core (plus provider packages) in requirements when using the bridge.","Check optional imports at startup rather than at first collection call.","Keep one package manager (pip or conda) per environment to avoid split installs."],"tags":["langchain","missing-dependency","embedding-function","python"],"backgroundTag":"missing-python-package","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}