1
$\begingroup$

After installing qiskit-terra via git (pip install qiskit), all python programs involving the line from qiskit import BasicAer do not run.

Example:

 from qiskit import *

 q = QuantumRegister(2)

 c = ClassicalRegister(2)

 qc = QuantumCircuit(q,c)

 qc.h(q[0])

<qiskit.extensions.standard.h.HGate object at 0x7f6a146ee7f0>

 qc.cx(q[0],q[1])

<qiskit.extensions.standard.cx.CnotGate object at 0x7f6a146ee940>

qc.measure(q,c)

<qiskit.circuit.instructionset.InstructionSet object at 0x7f6a146eea58>

 backend_sim = Aer.get_backend('qasm_smulator')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'Aer' is not defined
$\endgroup$
  • $\begingroup$ Thanks for the question. I'm interested to know where you found the code that uses BasicAer? $\endgroup$ – James Wootton Dec 18 '18 at 10:52
1
$\begingroup$

What was Aer in 0.6 is being renamed BasicAer in 0.7. The Aer name will then be used for a larger and fancier simulation package.

Since the current stable version is 0.6.1, your pip install will have given you that version of Terra. So you can simply replace each instance of BasicAer with Aer for now.

If you want to get 0.7 already, you can install with

pip install git+https://github.com/Qiskit/qiskit-terra.git

but it should also be moved to stable very soon.

$\endgroup$
  • $\begingroup$ Thanks. Renaming module BasicAer into Aer and inside the python program – BasicAer.get_backend("qasm_simulator") into Aer.get_backend("qasm_simulator") now it works! Is it the only "insider" point? $\endgroup$ – Holger Dec 18 '18 at 12:02
  • $\begingroup$ @Holger If this answer addressed your question sufficiently, please consider accepting it by clicking the check mark on the left. $\endgroup$ – Sanchayan Dutta Dec 18 '18 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.