Graphify-Labs/graphify · error · ImportError
AWS Bedrock extraction requires boto3. Run: pip install grap
Error message
AWS Bedrock extraction requires boto3. Run: pip install graphifyy[bedrock]
What it means
Raised by `_call_bedrock` when `import boto3` (plus botocore.config/exceptions) fails. The Bedrock backend uses boto3's Converse API with the standard AWS credential chain, so boto3 is a hard dependency for `backend="bedrock"`. The message points at the `graphifyy[bedrock]` extra which bundles it.
Source
Thrown at graphify/llm.py:1686
result["finish_reason"] = resp.choices[0].finish_reason
if _response_is_hollow(raw_content, result) and result["finish_reason"] != "length":
print(
"[graphify] azure returned a hollow response; treating as "
"truncation so adaptive retry can bisect the chunk.",
file=sys.stderr,
)
result["finish_reason"] = "length"
return result
def _call_bedrock(model: str, user_message: str, max_tokens: int = 8192, *, deep_mode: bool = False, images: list[_ImageRef] | None = None) -> dict:
"""Call AWS Bedrock via boto3 Converse API using the standard AWS credential chain."""
try:
import boto3
import botocore.config
import botocore.exceptions
except ImportError as exc:
raise ImportError(
"AWS Bedrock extraction requires boto3. Run: pip install graphifyy[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)
# Wire GRAPHIFY_API_TIMEOUT into the botocore read timeout. Without an
# explicit config, Converse uses botocore's 60s default and a long
# generation dies with "Read timeout on endpoint URL" no matter what the
# env var / --api-timeout is set to — the same gap #1112/#1442 closed for
# the claude-cli and secondary-dispatch paths, on the last cloud backend.
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"},
),View on GitHub (pinned to 7fe58b0b0f)
Solutions
- Install the extra: `pip install graphifyy[bedrock]` (or `pip install boto3`).
- Verify `python -c "import boto3, botocore"` in the running interpreter.
- If you didn't intend Bedrock, unset AWS_* env vars or pass `backend=` explicitly so auto-detection doesn't select it.
Example fix
# before pip install graphifyy # after pip install "graphifyy[bedrock]"
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec("boto3") is None:
raise SystemExit("bedrock backend needs boto3: pip install graphifyy[bedrock]") Prevention
- Install `graphifyy[bedrock]` on any machine where AWS_* credentials exist — auto-detection will select bedrock.
- If AWS env vars are set incidentally (e.g. base images), either install boto3 or pass `backend=` explicitly to avoid bedrock.
When it happens
Trigger: Calling `extract_files_direct(..., backend="bedrock")` (or having AWS credentials auto-detected) without boto3 installed in the environment.
Common situations: Installing graphify core without extras on a machine with AWS_* env vars set, so `detect_backend()` picks bedrock; CI images without boto3; venv conflicts where boto3 was removed.
Related errors
- the '{pkg}' package is required for this backend but is not
- the 'anthropic' package is required for this backend but is
- Azure OpenAI requires the openai package. Run: pip install o
- the 'boto3' package is required for this backend but is not
- matplotlib not installed. Run: pip install matplotlib
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/86e39b1517417974.
Report an issue: GitHub.