Amazon Braket Python SDK

raw JSON →
1.117.0 verified Mon Apr 27 auth: no python

An open source library for interacting with quantum computing devices on Amazon Braket. Current version 1.117.0, requires Python >=3.11. Released on a monthly cadence.

pip install amazon-braket-sdk
error AttributeError: module 'braket' has no attribute 'aws'
cause Incomplete installation or wrong import path. braket.aws is a subpackage that must be installed separately? No, it's part of SDK but may not be imported if not properly installed.
fix
Run 'pip install amazon-braket-sdk' again, or use 'from braket.aws import AwsDevice' directly.
error botocore.exceptions.NoCredentialsError: Unable to locate credentials
cause AWS credentials not configured. Braket SDK requires valid AWS credentials.
fix
Configure AWS CLI with 'aws configure' or set environment variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY.
error ValueError: The device 'arn:aws:braket:us-west-1::device/qpu/rigetti/Ankaa-3' is not available.
cause Device retired or ARN outdated. Ankaa-3 was retired in v1.116.0.
fix
Use a current device ARN, e.g., 'arn:aws:braket:us-west-1::device/qpu/rigetti/Cepheus1108Q'.
breaking Pickle deserialization disabled by default (v1.117.0). Loading pickled tasks/circuits from untrusted sources will fail unless explicitly opt-in.
fix Use braket.aws.aws_session.AwsSession with allow_pickle=True or deserialize with the appropriate safeguard.
deprecated Rigetti Ankaa-3 retired in v1.116.0. Code using that device ARN will fail.
fix Update device ARN to Rigetti Cepheus1108Q or other supported device.
gotcha Device ARN changes without deprecation notice. Example: Rigetti Cepheus1 renamed to Cepheus1108Q in v1.115.0.
fix Always check latest device ARNs from AWS documentation or AwsDevice.get_device_region_map().
gotcha Barrier targets must include at least one qubit; qubit 0 is now valid (v1.111.1). Previously barrier with no targets would print a warning.
fix Always specify qubit indices in Barrier().

Runs a Bell state circuit on IonQ Harmony device using AWS credentials from environment or session.

from braket.aws import AwsDevice
from braket.circuits import Circuit
from braket import BraketSDK

sdk = BraketSDK()
device = AwsDevice("arn:aws:braket:us-west-1::device/qpu/ionq/Harmony")
bell = Circuit().h(0).cnot(0, 1)
task = device.run(bell, shots=100)
print(task.result().measurement_counts)