Prefect Qiskit
This library integrates Prefect with Qiskit Primitives, which are vendor-agnostic abstractions for quantum computation.
Given the high cost and limited processing time of quantum computation, fatal errors can disrupt the entire workflow. This library enhances software fault tolerance by implementing primitive execution within a Prefect workflow.
For more details, visit the full documentation here.
Installation
Prefect Qiskit requires Python 3.10 or later.
We encourage install via pip
pip install prefect-qiskit
Pip will handle all dependencies automatically and you will always install the latest version.
Quantum Computing Workflow
The programming model and syntax are largely consistent with conventional Qiskit primitives,
allowing easy integration of Prefect's powerful job management features
into existing experiment codebases.
The key difference is the use of the QuantumRuntime Block,
which implements the Prefect API for quantum computing.
Unlike the conventional pattern that uses primitive class instances to create jobs, the runtime Block encapsulates vendor-specific job handling and provides robust error handling during execution.
For example, the following script samples the probability distribution of the Bell state using the Qiskit Aer simulator.
from prefect import flow, task
from prefect_qiskit import QuantumRuntime
from prefect_qiskit.vendors import QiskitAerCredentials
from qiskit.circuit import QuantumCircuit
from qiskit.transpiler import generate_preset_pass_manager
@task
def transpile_task(circuit, target):
pm = generate_preset_pass_manager(
optimization_level=2,
target=target,
)
return pm.run(circuit)
@flow
def sample_bell():
# 1. Create QuantumRuntime for Aer backend
credentials = QiskitAerCredentials(
num_qubits=2,
noise=True,
)
runtime = QuantumRuntime(
resource_name="aer_simulator",
credentials=credentials,
)
# 2. Create ISA quantum circuit
bell = QuantumCircuit(2)
bell.h(0)
bell.cx(0, 1)
bell.measure_all()
isa_circ = transpile_task(
circuit=bell,
target=runtime.get_target(),
)
# 3. Execute workflow sampler
result = runtime.sampler(
[isa_circ],
options={"default_shots": 100},
)
print(result[0].data.meas.get_counts())
# Run the flow
if __name__ == "__main__":
sample_bell()
Before running your workflow, start the Prefect server:
prefect server start --background
You can then run the workflow as a standard Python script. Once the workflow begins, you can monitor its execution status in the Prefect console. For common workflow usage, refer to the Prefect documentation.
Registering Blocks
Register Blocks to make them available for use with the Prefect console.
prefect block register -m prefect_qiskit
prefect block register -m prefect_qiskit.vendors
Contribution Guidelines
If you'd like to contribute to Prefect Qiskit, please take a look at our contribution guidelines. By participating, you are expected to uphold our code of conduct.
We use GitHub issues for tracking requests and bugs. For Prefect workflow, open issues and PRs against PrefectHQ/prefect instead of this repository. Likewise, open issues and PRs against Qiskit/qiskit for Qiskit Primitives.
License
Metadata
Release files for prefect-qiskit 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prefect_qiskit-0.2.1.tar.gz | 892.8 kB | With provenance | Details for prefect_qiskit-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prefect_qiskit-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for prefect_qiskit-0.2.1-py3-none-any.whl |
Total release size: 1.6 MB
Release files / prefect_qiskit-0.2.1.tar.gz
| Download URL | prefect_qiskit-0.2.1.tar.gz |
|---|---|
| Size | 892.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
349aed7c41647de6f0dd51f7ab06ff1b7f47c77a8b2e0c234eb27a9592ccb6ef
|
|
BLAKE2b-256 checksum How to use checksums |
549aed5b31d6240cabb367affbf9a5f9b086fd261160edd2380aa6dc5652a208
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.
Transparency logRelease files / prefect_qiskit-0.2.1-py3-none-any.whl
| Download URL | prefect_qiskit-0.2.1-py3-none-any.whl |
|---|---|
| Size | 715.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c8027f7b35b0cfb6e4c586804fae7f802728c8e89dabde95232a0b7a1b309ba
|
|
BLAKE2b-256 checksum How to use checksums |
b4f0b87666a3d96e12a8b8bc5e20178b3bd0e3a79017d2abc89597e67f6979bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.
Transparency logSecurity for prefect-qiskit 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for prefect_qiskit-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.