Amazon Braket Default Simulator

raw JSON →
1.39.0 verified Fri May 01 auth: no python

An open-source quantum circuit simulator that runs locally with the Amazon Braket SDK. It provides a default local simulator to test quantum programs before running on AWS-managed backends. Current version 1.39.0, actively maintained, supports Python >=3.11, and includes features like mid-circuit measurements and classical control flow.

pip install amazon-braket-default-simulator
error ModuleNotFoundError: No module named 'amazon_braket_default_simulator'
cause The package is not installed, or it is installed but not imported correctly (users often try to import it directly).
fix
Run pip install amazon-braket-default-simulator and use from braket.devices import LocalSimulator instead.
error AttributeError: 'LocalSimulator' object has no attribute 'run'
cause Using an older version of Braket SDK where `LocalSimulator` was not fully supported or imported from an incorrect module.
fix
Update both packages: pip install --upgrade amazon-braket-sdk amazon-braket-default-simulator and ensure imports are correct.
gotcha Do NOT manually import from `amazon_braket_default_simulator` directly. The package is a backend plugin; use `from braket.devices import LocalSimulator` to access the simulator. Direct imports may break or give unexpected results.
fix Use `from braket.devices import LocalSimulator` and ensure `amazon-braket-default-simulator` is installed as a dependency.
deprecated The `LocalSimulator` default backend may change. In older versions, it defaulted to a state vector simulator; newer versions may use density matrix. Always specify the backend if you rely on a specific simulation method.
fix Explicitly create the simulator with a backend: `LocalSimulator('braket_dm')` for density matrix or `LocalSimulator('braket_sv')` for state vector.

Set up and run a quantum circuit on the local default simulator.

from braket.devices import LocalSimulator
from braket.circuits import Circuit

# Create a local simulator device
device = LocalSimulator()

# Build a Bell state circuit
circuit = Circuit().h(0).cnot(0, 1)

# Run the circuit
result = device.run(circuit, shots=1000).result()

# Get measurement counts
counts = result.measurement_counts
print(counts)