mem0ai/mem0 · error · ImportError
The 'langchain_community' library is required. Please instal
Error message
The 'langchain_community' library is required. Please install it using 'pip install langchain_community'.
What it means
Error "The 'langchain_community' library is required. Please install it using 'pip install langchain_community'." thrown in mem0ai/mem0.
Source
Thrown at mem0/configs/vector_stores/langchain.py:10
from typing import Any, ClassVar, Dict
from pydantic import BaseModel, ConfigDict, Field, model_validator
class LangchainConfig(BaseModel):
try:
from langchain_community.vectorstores import VectorStore
except ImportError:
raise ImportError(
"The 'langchain_community' library is required. Please install it using 'pip install langchain_community'."
)
VectorStore: ClassVar[type] = VectorStore
client: VectorStore = Field(description="Existing VectorStore instance")
collection_name: str = Field("mem0", description="Name of the collection to use")
@model_validator(mode="before")
@classmethod
def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:
allowed_fields = set(cls.model_fields.keys())
input_fields = set(values.keys())
extra_fields = input_fields - allowed_fields
if extra_fields:
raise ValueError(
f"Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)}"
)
return valuesView on GitHub (pinned to 001c235229)
Solutions
- Install the dependency: pip install langchain_community.
When it happens
Trigger: Thrown at mem0/configs/vector_stores/langchain.py:10 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/7f354654c7034be1.
Report an issue: GitHub.