mem0ai/mem0 · critical · ImportError

langchain_aws is not installed. Please install it using pip

Error message

langchain_aws is not installed. Please install it using pip install langchain_aws

What it means

Import-time ImportError from the Neptune Analytics vector store module: it needs langchain_aws (which provides NeptuneAnalyticsGraph) and the import guard fires the moment the module is loaded without it. No AWS call is made; the backend simply cannot be constructed.

Source

Thrown at mem0/vector_stores/neptune_analytics.py:12

import logging
import re
import time
import uuid
from typing import Any, Dict, List, Optional

from pydantic import BaseModel

try:
    from langchain_aws import NeptuneAnalyticsGraph
except ImportError:
    raise ImportError("langchain_aws is not installed. Please install it using pip install langchain_aws")

from mem0.vector_stores.base import VectorStoreBase

logger = logging.getLogger(__name__)

_SAFE_FILTER_KEY = re.compile(r"^[a-zA-Z_~][a-zA-Z0-9_]*$")
_VALID_IDENTIFIER = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$")


def _validate_filter(key: str, value: Any) -> None:
    if not isinstance(key, str) or not _SAFE_FILTER_KEY.match(key):
        raise ValueError(f"Invalid filter key: {key!r}")
    if not isinstance(value, (str, int, float, bool)):
        raise ValueError(
            f"Filter value for {key!r} must be str, int, float, or bool, "
            f"got {type(value).__name__}"
        )

View on GitHub (pinned to 001c235229)

Solutions

  1. pip install langchain-aws
  2. Verify the package actually resolves (pip show langchain-aws) and pin it in the deploy environment
  3. If Neptune is not intended, switch the vector store provider in the Mem0 config back to the one you use

Example fix

# before
pip install mem0ai
# provider neptune_analytics -> ImportError

# after
pip install mem0ai langchain-aws
Defensive patterns

Strategy: validation

Validate before calling

try:
    from langchain_aws import NeptuneAnalyticsGraph  # noqa
except ImportError:
    raise SystemExit("langchain-aws required: pip install langchain-aws")

Prevention

When it happens

Trigger: Setting vector_store.provider to neptune_analytics ("neptune" family config) without langchain_aws installed; importing mem0.vector_stores.neptune_analytics in tooling/tests on an environment missing the extra.

Common situations: Base pip install mem0ai plus a Neptune config copied from docs; lambda/container images that prune 'unused' deps; version drift where langchain_aws was replaced by langchain-aws variants or removed from requirements.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/ffe3c41a165f48c3. Report an issue: GitHub.