mem0ai/mem0 · error · ImportError
langchain is not installed. Please install it using `pip ins
Error message
langchain is not installed. Please install it using `pip install langchain`
What it means
Error "langchain is not installed. Please install it using `pip install langchain`" thrown in mem0ai/mem0.
Source
Thrown at mem0/llms/langchain.py:10
from typing import Dict, List, Optional
from mem0.configs.llms.base import BaseLlmConfig
from mem0.llms.base import LLMBase
try:
from langchain.chat_models.base import BaseChatModel
from langchain_core.messages import AIMessage
except ImportError:
raise ImportError("langchain is not installed. Please install it using `pip install langchain`")
class LangchainLLM(LLMBase):
def __init__(self, config: Optional[BaseLlmConfig] = None):
super().__init__(config)
if self.config.model is None:
raise ValueError("`model` parameter is required")
if not isinstance(self.config.model, BaseChatModel):
raise ValueError("`model` must be an instance of BaseChatModel")
self.langchain_model = self.config.model
def _parse_response(self, response: AIMessage, tools: Optional[List[Dict]]):
"""
Process the response based on whether tools are used or not.
View on GitHub (pinned to 001c235229)
Solutions
- Install the dependency: pip install langchain.
When it happens
Trigger: Thrown at mem0/llms/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/f8561a14255993bf.
Report an issue: GitHub.