I am trying to get Quil-T working on rigetti.qpu.ankaa-3, using AzureQuantum.
I have the following which works perfectly:
import os
ID = "...."
os.environ["AZURE_QUANTUM_SUBSCRIPTION_ID"] = "ID"
os.environ["AZURE_QUANTUM_WORKSPACE_RG"] = "AzureQuantum"
os.environ["AZURE_QUANTUM_WORKSPACE_NAME"] = "Try100"
os.environ["AZURE_QUANTUM_WORKSPACE_LOCATION"] = "UK South"
from azure.quantum import Workspace
workspace = Workspace(
resource_id = "/subscriptions/ID/resourceGroups/AzureQuantum/providers/Microsoft.Quantum/Workspaces/Try100",
location = "uksouth")
print("This workspace's targets:")
for target in workspace.get_targets():
print("-", target.name)
from pyquil_for_azure_quantum import get_qpu, get_qvm
from pyquil.gates import CNOT, MEASURE, H
from pyquil.quil import Program
from pyquil.quilbase import Declare
program = Program(
Declare("ro", "BIT", 2),
H(0),
CNOT(0, 1),
MEASURE(0, ("ro", 0)),
MEASURE(1, ("ro", 1)),
).wrap_in_numshots_loop(10)
qpu = get_qpu("Ankaa-9Q-3")
qvm = get_qvm()
exe = qpu.compile(program) # This does not run quilc yet.
results = qpu.run(exe) # Quilc will run in the cloud before executing the program.
qvm_results = qvm.run(exe) # This runs the program on QVM in the cloud, not locally.
However when i try the following:
from pyquil.gates import CNOT, MEASURE, H
from pyquil.quil import Program
from pyquil.quilbase import Declare
from pyquil_for_azure_quantum import get_qpu, get_qvm
qc = get_qpu("Ankaa-9Q-3")
qc.compiler.get_version_info()
I get the following error:
{
"name": "GetISAError",
"message": "Call failed during http request: error in refresh_qcs_token: Requested an access token for a configuration without credentials.",
"stack": "---------------------------------------------------------------------------
GetISAError Traceback (most recent call last)
Cell In[28], line 8
4 from pyquil_for_azure_quantum import get_qpu, get_qvm
6 qc = get_qpu(\"Ankaa-9Q-3\")
----> 8 qc.compiler.get_version_info()
File /opt/anaconda3/envs/Quil/lib/python3.11/site-packages/pyquil_for_azure_quantum/init.py:78, in AzureQuantumComputer.init.<locals>.<lambda>()
75 def init(self, *, target: str, qpu_name: str):
76 # pylint: disable=abstract-class-instantiated
77 qam = AzureQuantumMachine(target=target)
---> 78 compiler = Proxy(lambda: get_qc(qpu_name).compiler)
79 super().init(name=qpu_name, qam=qam, compiler=compiler)
File /opt/anaconda3/envs/Quil/lib/python3.11/site-packages/pyquil/api/_quantum_computer.py:858, in get_qc(*failed resolving arguments*)
852 raise ValueError(
853 "pyQuil currently does not support initializing a noisy QuantumComputer "
854 "based on a QCSQuantumProcessor. Change noisy to False or specify the name of a QVM."
855 )
857 # 4. Not a special case, query the web for information about this quantum_processor.
--> 858 quantum_processor = get_qcs_quantum_processor(
859 quantum_processor_id=prefix, client_configuration=client_configuration
860 )
861 if qvm_type is not None:
862 # 4.1 QVM based on a real quantum_processor.
863 return _get_qvm_based_on_real_quantum_processor(
864 client_configuration=client_configuration,
865 name=name,
(...)
872 qvm_client=qvm_client,
873 )
File /opt/anaconda3/envs/Quil/lib/python3.11/site-packages/pyquil/quantum_processor/qcs.py:76, in get_qcs_quantum_processor(quantum_processor_id, client_configuration, timeout)
62 def get_qcs_quantum_processor(
63 quantum_processor_id: str,
64 client_configuration: Optional[QCSClient] = None,
65 timeout: float = 10.0,
66 ) -> QCSQuantumProcessor:
67 """Retrieve an instruction set architecture for the specified QPU ID and initialize a QCSQuantumProcessor with it.
68
69 :param quantum_processor_id: QCS ID for the quantum processor.
(...)
74 :return: A QCSQuantumProcessor with the requested ISA.
75 """
---> 76 isa = get_instruction_set_architecture(client=client_configuration, quantum_processor_id=quantum_processor_id)
78 return QCSQuantumProcessor(quantum_processor_id=quantum_processor_id, isa=isa)
GetISAError: Call failed during http request: error in refresh_qcs_token: Requested an access token for a configuration without credentials."
}