UTokyo-ICEPP / aqcel

Quantum circuit optimizer developed by ICEPP and LBNL
Apache License 2.0
7 stars 2 forks source link

'IBMQBackend' object has no attribute 'transpile' #2

Open rockingcubes opened 2 years ago

rockingcubes commented 2 years ago

I tried to use your notebook file "tutorial_aqcel". When I run all cell, the code below

aqcel_results_cc = icepp.pass_manager(test, level=2, backend=backend, backend_tket=dev_b, shots=1024, measure_type='cc').auto_manager()

gives the error mentioned below

-----> 'IBMQBackend' object has no attribute 'transpile'

Seems like there is a problem in the source code

`def transpile(self):

    if self.level != 0:
        qc = transpile(self.qc, basis_gates=['id','x','sx','rz','cx','reset'])
        tket_qc = qiskit_to_tk(qc)
        # self.backend_tket.compile_circuit(tket_qc, optimisation_level=2)
        self.aer_compiler.compile_circuit(tket_qc, optimisation_level=2)

        qc = tk_to_qiskit(tket_qc)
    else:
        qc = self.qc

    transpiled_qc = transpile(circuits=qc, backend=self.backend, basis_gates=None, seed_transpiler=1, optimization_level=self.level)

    return transpiled_qc`

line self.backend_tket.compile_circuit(tket_qc, optimisation_level=2) gives the above mentioned error. Can you help to resolve the issue?

My qiskit version is

{'qiskit-terra': '0.18.3', 'qiskit-aer': '0.9.1', 'qiskit-ignis': '0.6.0', 'qiskit-ibmq-provider': '0.18.1', 'qiskit-aqua': '0.9.5', 'qiskit': '0.32.1', 'qiskit-nature': None, 'qiskit-finance': None, 'qiskit-optimization': None, 'qiskit-machine-learning': None}

WonhoJang commented 2 years ago

Hi, I need more information about that bug. In my side, the same tutorial works.

In the original code, transpile functions is ↓ def transpile(self):

    if self.level != 0:
        qc = transpile(self.qc, basis_gates=['id','x','sx','rz','cx','reset'])
        tket_qc = qiskit_to_tk(qc)
        self.backend_tket.compile_circuit(tket_qc, optimisation_level=2)
        qc = tk_to_qiskit(tket_qc)
    else:
        qc = self.qc

    transpiled_qc = transpile(circuits=qc, backend=self.backend, basis_gates=None, seed_transpiler=1, optimization_level=self.level)

    return transpiled_qc
HangRen0 commented 2 years ago

I met exactly the same question, and I guess the issue is about the package versions. Could you send yours such that we can install the correct packages?