microsoft / azure-quantum-python

The azure-quantum python package submits jobs to the Azure Quantum service.
https://learn.microsoft.com/azure/quantum/
MIT License
122 stars 91 forks source link

Qiskit Job Id Retrival Error for qiskit-QAOA with Ionq Azure Quantum Provider #259

Closed leonox closed 2 years ago

leonox commented 2 years ago

Describe the bug Dear Azure Quantum Devs&Users, I am currently using qiskit on ionq hardware via azure quantum providers (as part of a quantum inspired application). Using the std example I can directly run circuits but not a qaoa optimization (Error:"FAILURE: Can not get job id, Resubmit the qobj to get job id. Error: 'list' object has no attribute 'clbits' ") - could this be because Quantum Instance does not utilizie ionq_provider/backend yet or the azure provider is missing arguments and what could help to identify/resolve the issue?

To Reproduce Code excerpts: azure_provider = AzureQuantumProvider(subscription_id="subid", resource_group="rog", name="qc", location="West Europe", credential=credential) simulator_backend = azure_provider.get_backend('ionq.simulator') seed = 42 cobyla = COBYLA() cobyla.set_options(maxiter=250) quantum_instance = QuantumInstance(backend=simulator_backend, seed_simulator=seed, seed_transpiler=seed) qaoa_mes = QAOA(optimizer=cobyla, reps=3, quantum_instance=quantum_instance) qaoa = MinimumEigenOptimizer(qaoa_mes) result = qaoa.solve(qp) throws the error with simulator_backend = Aer.get_backend('aer_simulator') it runs like a charm

azure_provider = AzureQuantumProvider(subscription_id="subid", resource_group="rog", name="qc", location="West Europe", credential=credential) simulator_backend = azure_provider.get_backend('ionq.simulator'); quantum_instance = QuantumInstance(backend=simulator_backend, seed_simulator=seed, seed_transpiler=seed) circuit = QuantumCircuit(3, 3) circuit.name = "Qiskit Sample - 3-qubit GHZ circuit" circuit.h(0) circuit.measure([0, 1, 2], [0, 1, 2]) job = simulator_backend.run(circuit, shots=100) result = job.result() works

Expected behavior return result without error

System information

cgranade commented 2 years ago

Thanks for filing! I've transferred the issue to the repo where we track issues with Azure Quantum usage from Python metaprogramming frameworks so that we can triage and respond appropriately. Thank you!

anpaz commented 2 years ago

This seems like another instance of #224

anpaz commented 2 years ago

@leonox, we think we have identified the problem and should get fixed with #278. In the meanwhile, we have published a beta package in case you want to try it yourself, you can pick it by installing version 0.23.201228b1, as in:

pip install azure-quantum[qiskit]==0.23.201228b1`

This is a pre-release version out of https://github.com/microsoft/qdk/tree/6814e494f754c619a1b17a05644d93e3064529ae. I was able to run your example using this version. Let us know how it goes.

leonox commented 2 years ago

Great thank you - the ionq.qpu and ionq.simulator are now responding!