2

I am trying to run a circuit on hardware. But I get the following error, which is not really helpful tbh.

TypeError: unsupported operand type(s) for -: 'NoneType' and 'int

It is unclear how to debug this as it only happens on hardware. The circuit runs successfully on the Aer simulator.

The following code I used to send it to the hardware.

# Initialize account.
service = QiskitRuntimeService(channel='ibm_quantum', token='TOKEN')

backend = service.least_busy(operational=True, simulator=False) #backend = FakeManilaV2()

pm = generate_preset_pass_manager(target=backend.target, optimization_level=1)

isa_circuit = pm.run(qc) pubs = [] for observable_operator in observable_operators: isa_obs = observable_operator.apply_layout(isa_circuit.layout) pubs.append((isa_circuit,isa_obs))

To run it on sim I uncomment the #backend = FakeManilaV2() and comment the line above it

And send it to the backend as follows:

with Session(backend=backend) as session:
    # Submit a request to the Estimator primitive within the session.
    estimator = EstimatorV2(mode=session)
    estimator.options.resilience_level = 1  # Set options.
    job = estimator.run(pubs)
    for idx, pub_result in enumerate(job.result()):
      print(f"Expectation values for pub {idx}: {pub_result.data.evs}")

1 Answers1

2

In the circuit I made use of ancillary qubits. After replacing these with ordinary qubits the circuit ran successfully.