chroma-core/chroma · error · ValueError

The boto3 python package is not installed. Please install it

Error message

The boto3 python package is not installed. Please install it with `pip install boto3`

What it means

When an amazon_bedrock embedding function is deserialized from a persisted config, build_from_config must create its own boto3.Session (there is no session= argument on this path), so it hard-imports boto3 and re-raises ImportError as this ValueError. boto3 is an optional dependency that `pip install chromadb` does not include. Note the asymmetry: constructing the function directly with a session works without boto3 in some flows, but config round-tripping always requires it.

Source

Thrown at chromadb/utils/embedding_functions/amazon_bedrock_embedding_function.py:93

                contentType=content_type,
            )
            response_body = json.loads(response.get("body").read())
            embedding = response_body.get("embedding")
            embeddings.append(np.array(embedding, dtype=np.float32))

        # Convert to the expected Embeddings type
        return cast(Embeddings, embeddings)

    @staticmethod
    def name() -> str:
        return "amazon_bedrock"

    @staticmethod
    def build_from_config(config: Dict[str, Any]) -> "EmbeddingFunction[Documents]":
        try:
            import boto3
        except ImportError:
            raise ValueError(
                "The boto3 python package is not installed. Please install it with `pip install boto3`"
            )

        model_name = config.get("model_name")
        session_args = config.get("session_args")
        if model_name is None:
            assert False, "This code should not be reached"
        kwargs = config.get("kwargs", {})

        if session_args is None:
            session = boto3.Session()
        else:
            session = boto3.Session(**session_args)

        return AmazonBedrockEmbeddingFunction(
            session=session, model_name=model_name, **kwargs
        )

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Install boto3 in the environment that deserializes: pip install boto3.
  2. Add boto3 (and the bedrock provider deps) to the same requirements pin list as chromadb so every runtime that touches these collections has it.
  3. Add a startup dependency check: python -c "import boto3" in the deploy healthcheck.

Example fix

# before: server worker raises
# ValueError "The boto3 python package is not installed. Please install it with `pip install boto3`"
ef = config_to_embedding_function(cfg)  # cfg["name"] == "amazon_bedrock"

# after: provision deps in the deserializing environment
# pip install boto3
import boto3  # startup check
ef = config_to_embedding_function(cfg)
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

if importlib.util.find_spec("boto3") is None:
    raise RuntimeError("boto3 is required to deserialize amazon_bedrock configs; run: pip install boto3")

from chromadb.utils.embedding_functions import config_to_embedding_function
ef = config_to_embedding_function(cfg)

Try / catch

from chromadb.utils.embedding_functions import config_to_embedding_function
try:
    ef = config_to_embedding_function(cfg)
except ValueError as e:
    if "boto3" in str(e):
        raise RuntimeError("Install boto3 in this environment before loading bedrock collections") from e
    raise

Prevention

When it happens

Trigger: config_to_embedding_function({"name": "amazon_bedrock", "config": {...}}) — typically inside a server or worker process that rehydrates persisted collection configs — in an environment where boto3 is not installed.

Common situations: The process that created the collection had boto3, but the API server / Celery worker / Lambda that later opens the collection does not; fresh deployments missing the aws extra; local venv vs deployed image drift.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/db7075562ed09450. Report an issue: GitHub.