mem0ai/mem0 · error · ImportError

The 'boto3' library is required. Please install it using 'pi

Error message

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

What it means

Raised at import time when boto3 (which pulls in botocore, needed for ClientError handling) is absent. S3 Vectors access is via the AWS SDK, which mem0 treats as an optional dependency, so importing mem0.vector_stores.s3_vectors in a bare environment fails before the class is defined.

Source

Thrown at mem0/vector_stores/s3_vectors.py:13

import json
import logging
from typing import Dict, List, Optional

from pydantic import BaseModel

from mem0.vector_stores.base import VectorStoreBase

try:
    import boto3
    from botocore.exceptions import ClientError
except ImportError:
    raise ImportError("The 'boto3' library is required. Please install it using 'pip install boto3'.")

logger = logging.getLogger(__name__)


class OutputData(BaseModel):
    id: Optional[str]
    score: Optional[float]
    payload: Optional[Dict]


class S3Vectors(VectorStoreBase):
    def __init__(
        self,
        vector_bucket_name: str,
        collection_name: str,
        embedding_model_dims: int,
        distance_metric: str = "cosine",
        region_name: Optional[str] = None,

View on GitHub (pinned to 001c235229)

Solutions

  1. Install it: `pip install boto3` in the runtime environment.
  2. Add boto3 (and any AWS extras like boto3-stubs for type checking) to the deployment requirements.
  3. Verify with `python -c "import boto3; print(boto3.__version__)"` if the error persists — usually a venv mismatch.

Example fix

# before
from mem0.vector_stores.s3_vectors import S3Vectors  # ImportError

# after
# pip install boto3
from mem0.vector_stores.s3_vectors import S3Vectors  # ok
Defensive patterns

Strategy: try-catch

Validate before calling

import importlib.util

if importlib.util.find_spec("boto3") is None:
    raise SystemExit("Missing dependency: boto3. Run: pip install boto3")

Try / catch

try:
    from mem0.vector_stores.s3_vectors import S3Vectors
except ImportError as e:
    raise RuntimeError(f"AWS SDK not installed: {e}. Required for the s3_vectors provider.") from e

Prevention

When it happens

Trigger: `from mem0.vector_stores.s3_vectors import S3Vectors` or `"vector_store": {"provider": "s3_vectors"}` in any environment where `import boto3` raises ImportError.

Common situations: Base `mem0ai` install used with the s3_vectors provider; Lambda/container images stripped of boto3 to save size; CI matrices that install only per-provider extras; local dev on machines without AWS tooling.

Related errors


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