Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rockingcubes opened this issue Apr 20, 2022 · 2 comments
Open

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

rockingcubes opened this issue Apr 20, 2022 · 2 comments

Comments

@rockingcubes
Copy link

rockingcubes commented Apr 20, 2022

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
Copy link
Collaborator

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

  • Did you add 'self.aer_compiler.compile_circuit(tket_qc, optimisation_level=2)' by yourself? I cannot find such a line in an original source code. (Maybe "self.backend_tket.compile_circuit(tket_qc, optimisation_level=2)" was commented out.
  • It seems the bugs came from the tket compiler. How about the version of pytket and pytket-qiskit?

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants