Azure Quantum IonQ Provider Job Failure (Error message: "job.targetHardware" is required)

Colin Burdine 25 Reputation points
2024-04-04T18:35:56.9133333+00:00

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.

Azure Quantum
Azure Quantum
An Azure service that provides quantum computing and optimization solutions.
71 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,025 questions
{count} votes

Accepted answer
  1. kobulloc-MSFT 26,346 Reputation points Microsoft Employee
    2024-04-10T07:39:26.4233333+00:00

    Hello, @Colin Burdine !

    Why am I getting an Azure Quantum IonQ Provider Job Failure (Error message: "job.targetHardware" is required)?

    I reached out to the Azure Quantum team and this appears to have been an issue with the IonQ service that has now been resolved. The following Qiskit circuit sample can now be completed without issue:

    https://learn.microsoft.com/en-us/azure/quantum/quickstart-microsoft-qiskit?source=recommendations&tabs=tabid-ionq&pivots=platform-local

    If you are still running into this issue, please let us know in the comments so we can continue to investigate this. If the problem has been resolved, please take a moment to accept answers.

    Thank you for helping to improve Microsoft Q&A!

    User's image

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.