You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to import the EstimatorQNN from the qiskit_machine_learning.neural_networks module, I encounter an ImportError related to BaseEstimator. The error message is as follows: ImportError: cannot import name 'BaseEstimator' from 'qiskit.primitives' (/usr/local/lib/python3.11/dist-packages/qiskit/primitives/__init__.py) Steps to Reproduce:
Install the latest version of Qiskit and Qiskit Machine Learning.
Run the following code:
from qiskit_machine_learning.neural_networks import EstimatorQNN
3. The error occurs when the import statement for EstimatorQNN is executed. Expected Behavior:
The EstimatorQNN should import without errors, as documented in the Qiskit Machine Learning tutorials.
Actual Behavior:
An ImportError occurs because BaseEstimator cannot be found in the qiskit.primitives module.
Environment:
Python version: 3.11
Qiskit version: 0.38.0
Qiskit Machine Learning version: 0.3.0
Operating System: Linux
Additional Information:
I have tried upgrading both Qiskit and Qiskit Machine Learning using the following commands: pip install --upgrade qiskit pip install --upgrade qiskit-machine-learning
However, the issue persists.
The text was updated successfully, but these errors were encountered:
I am confused. You list steps to reproduce which say to install the latest versions of Qiskit And Qiskit ML yet your environment shows 0.38 for Qiskit and 0.3.0 for Qiskit ML which are ancient.
I would install the latest Qiskit ML: 0.8.2 and a version of Qiskit < 2.0.0 say 1.4.2 which is the latest version less than 2.0. It needs < 2.0 as ML is not yet compatible with Qiskit 2.0 (as per issue #897 here which is for adding support for this). Version 2.0 removed the Primitives Version 1, of which BaseEstimator is one of those classes, leaving the newer Version 2 ones which ML has yet to support.
Indeed, I would suggest upgrading your Qiskit ML to version 0.8.2 - which we actively support - and Qiskit < 2.0.0. You may find the requirements.txt file helpful in checking which dependencies are supported by Qiskit ML versions.
Note that running pip install --upgrade qiskit may not be sufficient to upgrade qiskit from a 0.x version to 1.x; see the migration guide, particularly the following:
Do not try to upgrade an existing Python virtual environment to Qiskit 1.0 in-place.
We will not make similar breaking packaging changes in the future. This is a one-time event, at the release of Qiskit 1.0, specifically so that our packaging story will be as easy as possible in the future.
When I try to import the EstimatorQNN from the qiskit_machine_learning.neural_networks module, I encounter an ImportError related to BaseEstimator. The error message is as follows:
ImportError: cannot import name 'BaseEstimator' from 'qiskit.primitives' (/usr/local/lib/python3.11/dist-packages/qiskit/primitives/__init__.py)
Steps to Reproduce:
from qiskit_machine_learning.neural_networks import EstimatorQNN
3. The error occurs when the import statement for EstimatorQNN is executed.
Expected Behavior:
The EstimatorQNN should import without errors, as documented in the Qiskit Machine Learning tutorials.
Actual Behavior:
An ImportError occurs because BaseEstimator cannot be found in the qiskit.primitives module.
Environment:
Python version:
3.11
Qiskit version:
0.38.0
Qiskit Machine Learning version:
0.3.0
Operating System:
Linux
Additional Information:
I have tried upgrading both Qiskit and Qiskit Machine Learning using the following commands:
pip install --upgrade qiskit pip install --upgrade qiskit-machine-learning
However, the issue persists.
The text was updated successfully, but these errors were encountered: