Implementation:Anthropics Anthropic sdk python Provider Dependency Install
| Knowledge Sources | |
|---|---|
| Domains | Cloud_Deployment, LLM, Infrastructure |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
This page documents the installation commands and optional dependency declarations that enable cloud provider support in the Anthropic Python SDK. The SDK uses Python package extras defined in pyproject.toml to manage provider-specific dependencies.
Type: External Tool Doc
Source: pyproject.toml:L41-44
Installation Commands
AWS Bedrock
pip install anthropic[bedrock]
This installs the core anthropic package plus the Bedrock-specific dependencies:
boto3 >= 1.28.57-- AWS SDK for Python, used to create sessions and resolve credentials.botocore >= 1.31.57-- Low-level AWS library providingSigV4Authfor request signing andEventStreamBufferfor streaming response decoding.
Google Cloud Vertex AI
pip install anthropic[vertex]
This installs the core anthropic package plus the Vertex-specific dependency:
google-auth[requests] >= 2, < 3-- Google authentication library with therequeststransport extra for refreshing OAuth2 credentials via HTTP.
Azure AI Foundry
pip install anthropic
No extra dependencies are required. The Foundry client uses the core SDK's httpx transport and authenticates via API keys or user-supplied Azure AD token provider callables. No Azure-specific libraries are needed.
Multiple Providers
To support multiple providers in the same environment:
pip install anthropic[bedrock,vertex]
pyproject.toml Declaration
The optional dependencies are declared in pyproject.toml under [project.optional-dependencies]:
[project.optional-dependencies]
vertex = ["google-auth[requests] >=2, <3"]
bedrock = ["boto3 >= 1.28.57", "botocore >= 1.31.57"]
The core dependencies (always installed) are:
[project]
dependencies = [
"httpx>=0.25.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.10, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"jiter>=0.4.0, <1",
"docstring-parser>=0.15,<1",
]
Dependency Version Constraints
| Extra | Package | Version Constraint | Purpose |
|---|---|---|---|
[bedrock] |
boto3 |
>= 1.28.57 |
AWS session creation and credential resolution |
[bedrock] |
botocore |
>= 1.31.57 |
SigV4 request signing and EventStream decoding |
[vertex] |
google-auth[requests] |
>= 2, < 3 |
Google OAuth2 credentials and token refresh |
| (none) | httpx |
>= 0.25.0, < 1 |
HTTP transport (used by all providers including Foundry) |
The version lower bounds ensure that the SDK has access to the specific APIs it depends on (e.g., SigV4Auth, EventStreamBuffer, google.auth.default()). The upper bounds on google-auth prevent breaking changes from major version upgrades.
Runtime Validation
If the required extras are not installed, the SDK raises clear errors at import or initialization time:
- Bedrock: Attempting to use
AnthropicBedrockwithoutboto3raisesModuleNotFoundErrorwhen_prepare_request()tries to importbotocore.auth.SigV4Auth. - Vertex: The
load_auth()function catchesModuleNotFoundErrorand re-raises with the message:"Could not import google.auth, you need to install the SDK with pip install anthropic[vertex]". - Foundry: No runtime validation is needed since there are no extra dependencies.