mem0ai/mem0 · error · ImportError

The 'litellm' library is required. Please install it using '

Error message

The 'litellm' library is required. Please install it using 'pip install litellm'.

What it means

Error "The 'litellm' library is required. Please install it using 'pip install litellm'." thrown in mem0ai/mem0.

Source

Thrown at mem0/llms/litellm.py:7

import json
from typing import Dict, List, Optional

try:
    import litellm
except ImportError:
    raise ImportError("The 'litellm' library is required. Please install it using 'pip install litellm'.")

from mem0.configs.llms.base import BaseLlmConfig
from mem0.llms.base import LLMBase
from mem0.memory.utils import extract_json


class LiteLLM(LLMBase):
    def __init__(self, config: Optional[BaseLlmConfig] = None):
        super().__init__(config)

        if not self.config.model:
            self.config.model = "gpt-5-mini"

    def _parse_response(self, response, tools):
        """
        Process the response based on whether tools are used or not.

        Args:

View on GitHub (pinned to 001c235229)

Solutions

  1. Install the dependency: pip install litellm.

When it happens

Trigger: Thrown at mem0/llms/litellm.py:7 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/804c5a7405a79cc0. Report an issue: GitHub.