-
Notifications
You must be signed in to change notification settings - Fork 139
cannot import "BaseBackent" from "qiskit.providers" #577
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
Comments
I will also note that only the very latest version of Qiskit supports Python 3.12. None of the rest of the above do. I would check what your installation as to what is actually there. For now 3.11 is the newest version consistent with all those packages. |
I can confirm that I can reproduce the error after following the same steps for python3.12. What happened in my environment is that
|
There is no cplex for 3.12 (again latest version supported is 3.11). In optimization 0.3.2 it has to install cplex if Python < 3.10, so I guess it was able to figure it could satisfy that request for the optional install by dropping back to 0.3.2 whereupon it does nothing in essence as far as cplex is concerned. |
Thanks for the reply and help! 👍 |
i am facing an error with the import line Description: I tried to uninstall and install packages. And also setting up in a separate environment but still i am facing the issue cannot import name backendve from qiskit.providers could you please help to resolve this issue. |
It seems like you have installed the latest Qiskit 2.0 which removed a lot of earlier deprecated classes such as the one you mention and also V1 primitives which ML depends on still. ML is not compatible with Qiskit 2.0 at present. I would suggest installed the latest Qiskit version before 2.0 ie. 1.4.2 Do |
Environment
What is happening?
I am trying to run the quiskit optimization example from:
https://qiskit.org/ecosystem/optimization/tutorials/02_converters_for_quadratic_programs.html
And get the following import error:
ImportError: cannot import name 'BaseBackend' from 'qiskit.providers' (/home/jdara/anaconda3/envs/quant4/lib/python3.12/site-packages/qiskit/providers/init.py)
How can we reproduce the issue?
First run these pip commands:
pip install qiskit
pip install qiskit-ibm-runtime
pip install qiskit[visualization]
pip install qiskit-optimization
pip install 'qiskit-optimization[cplex]'
pip install 'qiskit-optimization[cvx]'
pip install 'qiskit-optimization[matplotlib]'
Then run in a jupyternotebook:
from qiskit_optimization.algorithms import CplexOptimizer
cplex_optimizer = CplexOptimizer()
This results in this error:
ImportError: cannot import name 'BaseBackend' from 'qiskit.providers' (/home/jdara/anaconda3/envs/quant4/lib/python3.12/site-packages/qiskit/providers/init.py)
I am running in a anaconda environment if this should be relevant
What should happen?
I would expect the import not to go wrong
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: