Skip to content
Advertisement

Bundled QC Circuit on Qiskt (Index error)

I’m trying to execute a list of ciruits on qiskit, but was faced with this strange dilemma:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-4-653a7fab138c> in <module>
----> 1 job = execute(circuit_list, backend = device, shots = 1024)
      2 print(job.job_id())

~anaconda3envsqc_envlibsite-packagesqiskitexecute_function.py in execute(experiments, backend, basis_gates, coupling_map, backend_properties, initial_layout, seed_transpiler, optimization_level, pass_manager, qobj_id, qobj_header, shots, memory, max_credits, seed_simulator, default_qubit_los, default_meas_los, qubit_lo_range, meas_lo_range, schedule_los, meas_level, meas_return, memory_slots, memory_slot_size, rep_time, rep_delay, parameter_binds, schedule_circuit, inst_map, meas_map, scheduling_method, init_qubits, **run_config)
    274     """
    275     if isinstance(experiments, Schedule) or (
--> 276         isinstance(experiments, list) and isinstance(experiments[0], Schedule)
    277     ):
    278         # do not transpile a schedule circuit

IndexError: list index out of range

I did not transpile any circuit before adding it to the list nor am I transpiling it during execution. Does anyone have an answer to why this is happening?

Edit: I’m not using a schedule either.

Advertisement

Answer

That error would be caused by passing an empty list to execute(). What are the contents of circuit_list in your code?

For the record, the execute() function is just a shorthand convenience function doig backend.run(transpile(experiments, backend)). So you’re doing the correct thing not transpiling before passing circuit objects to execute().

Advertisement