1
$\begingroup$

when I try to use a quantum instance I get the error below. I'm using qiskit 0.37.0 and qiskit-aqua 0.9.5. Any hint suggested? Thanks in advance

ImportError                               Traceback (most recent call last)
/var/folders/gl/v7sz8_9j0nqcpxrr79rjtq7w0000gn/T/ipykernel_64860/3839405800.py in <module>
      7 print(provider.backends())
      8 
----> 9 from qiskit.aqua import QuantumInstance
     10 
     11 backend = provider.get_backend('ibmq_manila')

/Applications/miniconda3/envs/eelbrain/lib/python3.9/site-packages/qiskit/aqua/__init__.py in <module>
     74 from .missing_optional_library_error import MissingOptionalLibraryError
     75 from .aqua_globals import aqua_globals
---> 76 from .quantum_instance import QuantumInstance
     77 from .algorithms import QuantumAlgorithm
     78 from ._logging import (QiskitLogDomains,

/Applications/miniconda3/envs/eelbrain/lib/python3.9/site-packages/qiskit/aqua/quantum_instance.py in <module>
     19 import numpy as np
     20 
---> 21 from qiskit.providers import Backend, BaseBackend
     22 from qiskit.transpiler import CouplingMap, PassManager
     23 from qiskit.transpiler.layout import Layout

ImportError: cannot import name 'BaseBackend' from 'qiskit.providers' (/Applications/miniconda3/envs/eelbrain/lib/python3.9/site-packages/qiskit/providers/__init__.py)```
$\endgroup$
3
  • $\begingroup$ The import error coming from qiskit.aqua is what's wrong in my opinion. It's been months since aqua is not updated and supported anymore in qiskit, see this qiskit.org/documentation/stable/0.32/aqua_tutorials/…. It is quite old as well but it will give you clues as to what to replace aqua tools with. $\endgroup$
    – Lena
    Commented Jul 4, 2022 at 15:21
  • $\begingroup$ Lena, your suggestion has been very helpful: problem solved. Thank you so much for taking time to help me Andrea $\endgroup$ Commented Jul 5, 2022 at 8:37
  • $\begingroup$ @AndreaMameli I am facing the same problem. Please suggest a way to resolve it. I am getting this error? $\endgroup$
    – Manu
    Commented Feb 28, 2023 at 8:58

1 Answer 1

3
$\begingroup$

I was also facing the same issue. The problem here is with qiskit version you are using. use qiskit 0.31.0 as BaseBackend is in this version. to install this version simply run

pip install qiskit==0.31.0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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