Graphify-Labs/graphify · error · ImportError

the 'boto3' package is required for this backend but is not

Error message

the 'boto3' package is required for this backend but is not installed. Install it with:  uv tool install "graphifyy[bedrock]" --force  (uv tool), or  pip install boto3  (pip/venv install).

What it means

ImportError raised when backend='bedrock' is selected but boto3 (and botocore.config) are not installed. Like the other backends, bedrock is an optional extra; the message points at the graphifyy[bedrock] extra or a plain pip install, and chains the original ModuleNotFoundError.

Source

Thrown at graphify/llm.py:2660

            raise RuntimeError(f"claude -p reported an error: {cli_error[:500]}")
        envelope = _claude_cli_envelope(proc.stdout)
        cli_usage = envelope.get("usage") or {}
        if cli_usage:
            _rec(
                (cli_usage.get("input_tokens", 0) or 0)
                + (cli_usage.get("cache_read_input_tokens", 0) or 0)
                + (cli_usage.get("cache_creation_input_tokens", 0) or 0),
                cli_usage.get("output_tokens", 0),
            )
        return envelope.get("result", "")


    if backend == "bedrock":
        try:
            import boto3
            import botocore.config
        except ImportError as exc:
            raise ImportError(_backend_pkg_hint("boto3", "bedrock")) from exc
        region = os.environ.get("AWS_REGION") or os.environ.get("AWS_DEFAULT_REGION") or "us-east-1"
        profile = os.environ.get("AWS_PROFILE")
        session = boto3.Session(profile_name=profile, region_name=region)
        client = session.client(
            "bedrock-runtime",
            config=botocore.config.Config(
                read_timeout=_resolve_api_timeout(),
                connect_timeout=10,
                retries={"max_attempts": _resolve_max_retries() + 1, "mode": "adaptive"},
            ),
        )
        resp = client.converse(
            modelId=mdl,
            messages=[{"role": "user", "content": [{"text": prompt}]}],
            inferenceConfig=_bedrock_inference_config(max_tokens, mdl),
        )
        bu = resp.get("usage") or {}
        if bu:

View on GitHub (pinned to 7fe58b0b0f)

Solutions

  1. Install the extra: `uv tool install "graphifyy[bedrock]" --force` or `pip install boto3` in the active environment.
  2. Confirm AWS credentials and region are usable: `aws sts get-caller-identity` - bedrock also needs AWS_REGION/AWS_DEFAULT_REGION (default us-east-1) and optionally AWS_PROFILE.
  3. Verify in the same interpreter: `python -c "import boto3, botocore.config"`.

Example fix

# before
backend = "bedrock"   # ImportError: boto3 required

# after
# pip install boto3  (or uv tool install "graphifyy[bedrock]" --force)
backend = "bedrock"
# ensure region + credentials:
#   export AWS_REGION=us-east-1 && aws sts get-caller-identity
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util
if importlib.util.find_spec("boto3") is None or importlib.util.find_spec("botocore") is None:
    raise SystemExit("backend 'bedrock' needs boto3: pip install boto3")

Try / catch

try:
    result = call_llm(prompt, backend="bedrock")
except ImportError as exc:
    if "boto3" in str(exc):
        raise SystemExit(f"Missing optional dep: {exc}") from exc
    raise

Prevention

When it happens

Trigger: An LLM call dispatches to the bedrock branch at llm.py:2662-2666 and `import boto3` or `import botocore.config` fails. Configuration names bedrock (env/config/providers.json), e.g. to use Claude via AWS Bedrock with corporate credentials.

Common situations: Teams standardize on AWS and set backend=bedrock without adding the extra; uv tool installs of graphifyy that only carried [anthropic]; environments where boto3 was uninstalled as part of a botocore/boto3 version conflict with other tooling.

Related errors


AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14). Data as JSON: /api/errors/863201fa13398a80. Report an issue: GitHub.