QCS SDK Python

raw JSON →
0.26.1 verified Sat May 09 auth: no python

Python interface for the QCS Rust SDK, providing the core data structures and client for interacting with Rigetti Quantum Cloud Services. Version 0.26.1 requires Python >=3.10 and <4.0. Release cadence is irregular, tied to the underlying Rust SDK.

pip install qcs-sdk-python
error ModuleNotFoundError: No module named 'qcs.sdk'
cause Incorrect import path; many tutorials use the old 'qcs.sdk' module name.
fix
Use 'from qcs_sdk import ...' (underscore, not dot).
error TypeError: __init__() got an unexpected keyword argument 'credentials'
cause Using the old QCSClient constructor with 'credentials' parameter. It was renamed to 'api_key' and 'api_url'.
fix
Use 'QCSClient(api_key='...', api_url='...')' instead.
error AttributeError: module 'qcs_sdk' has no attribute 'ExecutionConfig'
cause ExecutionConfig was removed in v0.21; configuration is now done via client methods.
fix
Use client methods like 'client.compile_program()' or 'client.run_program()' instead of ExecutionConfig.
breaking In v0.24, the 'QCSClient' constructor changed: 'api_key' and 'api_url' parameters replaced 'credentials' and 'endpoint'. Code using the old signature will fail.
fix Update client initialization to use new parameters: QCSClient(api_key=..., api_url=...).
breaking The 'ExecutionData' class was moved from qcs_sdk.execution.ExecutionData to qcs_sdk.ExecutionData in v0.20. Old imports break.
fix Change import to 'from qcs_sdk import ExecutionData'.
deprecated The function 'get_qpu' is deprecated in favor of 'QCSClient.get_quantum_processor()' since v0.22.
fix Use client.get_quantum_processor(quantum_processor_id) instead.
gotcha The package name on PyPI is 'qcs-sdk-python', but the importable module is 'qcs_sdk' (underscore, not hyphen). This mismatch confuses beginners.
fix Always use 'import qcs_sdk' or 'from qcs_sdk import ...' in code, never 'qcs-sdk-python'.

Initialize a QCSClient and list available quantum processors. Set environment variables QCS_API_KEY and QUANTUM_PROCESSOR_ID for authentication.

import os
from qcs_sdk import QCSClient

client = QCSClient(
    quantum_processor_id=os.environ.get("QUANTUM_PROCESSOR_ID", ""),
    api_key=os.environ.get("QCS_API_KEY", ""),
    api_url=os.environ.get("QCS_API_URL", "https://api.qcs.rigetti.com")
)
print(client.list_quantum_processors())