# Error when running a VQE circuit in IBMQ backends

I want to run a VQE circuit of 4 qubits for a simple Hamiltonian with Qiskit. The circuit run smoothly in simulators. However, when I try to implement it on real IBM' quantum computers it gives me the following error message:

RequestsApiError: '403 Client Error: Forbidden for url: https://runtime-us-east.quantum-computing.ibm.com/jobs. '

From previous posts, it looks like the problem is not about my code but rather because it fails to request an access to the IBMQ service:

I have checked all available backends available to me and all of them returned the same error. In addition, I have checked that I do have Qiskit Nature access (see the screenshot attached). Anyone familiar with this? I will also appreciate if anyone could point out the rule of using free IBMQ access since all the links available on previous forums no longer work.

I enclose the code below. Thanks so much in advance!

import numpy as np

# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, Aer, IBMQ
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
from qiskit.providers.aer import QasmSimulator
from qiskit import Aer
enter preformatted text here

from qiskit.opflow import I, X, Z
from qiskit.algorithms import VQE
from qiskit.algorithms.optimizers import SPSA

H = 0.5*(Z^Z^I^I)-0.5*(I^Z^Z^I)+0.5*(I^I^Z^Z)-0.5*(Z^I^I^Z)

optimizer = SPSA()
backend = Aer.get_backend('statevector_simulator')
vqe_sim = VQE(optimizer=optimizer, quantum_instance=backend)

from qiskit.circuit import QuantumCircuit, ParameterVector

hets_circ = QuantumCircuit(4)
params = ParameterVector('theta', length=32)
it = iter(params)

hets_circ.ry(next(it), 0)
hets_circ.rz(next(it), 0)
hets_circ.ry(next(it), 1)
hets_circ.rz(next(it), 1)
hets_circ.ry(next(it), 2)
hets_circ.rz(next(it), 2)
hets_circ.ry(next(it), 3)
hets_circ.rz(next(it), 3)

hets_circ.cx(0,1)
hets_circ.ry(next(it),0)
hets_circ.cx(1,2)
hets_circ.rz(next(it),0)
hets_circ.ry(next(it),1)
hets_circ.cx(2,3)
hets_circ.rz(next(it),1)
hets_circ.ry(next(it),2)
hets_circ.ry(next(it),3)
hets_circ.rz(next(it),2)
hets_circ.rz(next(it),3)

hets_circ.cx(0,1)
hets_circ.ry(next(it),0)
hets_circ.cx(1,2)
hets_circ.rz(next(it),0)
hets_circ.ry(next(it),1)
hets_circ.cx(2,3)
hets_circ.rz(next(it),1)
hets_circ.ry(next(it),2)
hets_circ.ry(next(it),3)
hets_circ.cx(0,1)
hets_circ.rz(next(it),2)
hets_circ.rz(next(it),3)
hets_circ.ry(next(it),0)
hets_circ.cx(1,2)
hets_circ.rz(next(it),0)
hets_circ.ry(next(it),1)
hets_circ.cx(2,3)
hets_circ.rz(next(it),1)
hets_circ.ry(next(it),2)
hets_circ.ry(next(it),3)
hets_circ.rz(next(it),2)
hets_circ.rz(next(it),3)

hets_circ.draw(output='mpl')

vqe_sim.var_form = hets_circ
result_sim = vqe_sim.compute_minimum_eigenvalue(H)
print('Simulated VQE:', result_sim.eigenvalue.real, 'Reference:', -2)

provider = IBMQ.get_provider()  # Change this to your provider.

from qiskit_nature.runtime import VQEProgram

backend = provider.get_backend('ibmq_manila')

vqe_qc = VQEProgram(ansatz=hets_circ, optimizer=optimizer, provider=provider, backend=backend, shots=100)

result_qc = vqe_qc.compute_minimum_eigenvalue(H)
print('VQE:', result_qc.eigenvalue.real)


Can you try running this code and posting a screenshot?

runtime_backends = provider.backends(input_allowed='runtime')
print(f"Backends that support Qiskit Runtime: {runtime_backends}")


Afaik, qiskit-runtime is not available on quantum backends in the open free to access tiers. The only backend I know of that works for qiskit-runtime as of the time of writing this comment is the 'ibmq-qasm-simulator'

You can setup a test server by checking out the instructions given here: https://github.com/delapuente/qiskit-runtime/

• Oh no, that is bad. I think you are right, here is the output of your line of code above. Thanks for your answer! Backends that support Qiskit Runtime: [<IBMQSimulator('ibmq_qasm_simulator') from IBMQ(hub='ibm-q', group='open', project='main')>] Sep 4 at 18:22
• I am not aware if its available on any other provider other than IBMQ systems :sweat_smile: If you have a research project, you can probably approach for the researchs program (restricted to 7 qubits) here: quantum-computing.ibm.com/programs/researchers You can try setting up a test runtime server locally: github.com/delapuente/qiskit-runtime They may add in a functionality to specify a backend later, but as of now, there isnt a way to do it easily atleast :) Sep 4 at 18:31
• @qubit96 You can always run your VQE circuit without using Qiskit Runtime; it'll just be slower. Sep 7 at 12:15