I am encountering an issue when submitting quantum circuit jobs to the IonQ providers with the Python Azure Quantum Qiskit client. After submission, jobs are returning as Failed with the error message:
Error code: InvalidInputData
Error message: "job.targetHardware" is required
This issue occurs when I submit to both the ionq.simulator
and ionq.qpu
providers. It also occurs when running the "Hello, World: Qiskit" and "Hello, World: Q#" template notebooks (found in the Azure notebook Sample gallery), which suggests this could be an issue with my Azure Quantum workspace configuration or a possibly an API issue.
Here's a minimal example that produces the failed job:
from qiskit import QuantumCircuit
from azure.quantum import Workspace
from azure.quantum.qiskit import AzureQuantumProvider
workspace = Workspace(resource_id = "...", # <-- my workspace resource ID here
location = "eastus")
provider = AzureQuantumProvider(workspace)
ionq_simulator_backend = provider.get_backend("ionq.simulator")
circuit = QuantumCircuit(1,1)
circuit.name = "Single qubit random"
circuit.h(0)
circuit.measure(0, 0)
job = ionq_simulator_backend.run(circuit, shots=100)
print("Job id:", job.id())
result = job.result()
print(result.get_counts())
This successfully submits the job and prints the job ID, but when the result is retrieved it throws a client-side error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[10], line 23
19 print("Job id:", job.id())
21 result = job.result()
---> 23 print(result.get_counts())
File /usr/local/lib/python3.11/site-packages/qiskit/result/result.py:269, in Result.get_counts(self, experiment)
267 dict_list = []
268 for key in exp_keys:
--> 269 exp = self._get_experiment(key)
270 try:
271 header = exp.header.to_dict()
File /usr/local/lib/python3.11/site-packages/qiskit/result/result.py:397, in Result._get_experiment(self, key)
395 result_status = getattr(self, "status", "Result was not successful")
396 exp_status = getattr(exp, "status", "Experiment was not successful")
--> 397 raise QiskitError(result_status, ", ", exp_status)
File /usr/local/lib/python3.11/site-packages/qiskit/exceptions.py:97, in QiskitError.__init__(self, *message)
95 def __init__(self, *message):
96 """Set the error message."""
---> 97 super().__init__(" ".join(message))
98 self.message = " ".join(message)
TypeError: sequence item 0: expected str instance, NoneType found
Checking my workspace job queue, it appears that the job above was submitted correctly:
{"gateset": "qis", "qubits": 1, "circuit": [{"gate": "h", "targets": [0]}]}
however, the job is reported as failed with the error:
Error code: InvalidInputData
Error message: "job.targetHardware" is required
which is probably causing the Python error above.
Any thoughts on what I could be doing incorrectly here? Thanks in advance for your help.