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

Bad import of the VQE class when importing from algorithms #9894

Closed
pfargas opened this issue Apr 1, 2023 · 3 comments
Closed

Bad import of the VQE class when importing from algorithms #9894

pfargas opened this issue Apr 1, 2023 · 3 comments
Labels
bug Something isn't working mod: algorithms Related to the Algorithms module

Comments

@pfargas
Copy link

pfargas commented Apr 1, 2023

Environment

  • Qiskit Terra version:
  • Python version:
  • Operating system:

What is happening?

If you import VQE from qiskit.algorithms, it returns the deprecated version, found in minimum_eigen_solvers

How can we reproduce the issue?

from qiskit.algorithms import VQE

What should happen?

The import should get the VQE class found in minimum_eigensolvers, not minimum_eigen_solvers

Any suggestions?

No response

@pfargas pfargas added the bug Something isn't working label Apr 1, 2023
@woodsp-ibm woodsp-ibm added the mod: algorithms Related to the Algorithms module label Apr 1, 2023
@woodsp-ibm
Copy link
Member

This is as intended since if the import was switched it would break a lot of existing code that used the older VQE that is based on using Quantum Instance. Also at the moment that VQE is pending deprecated, not yet deprecated, which should happen in this upcoming release. There is a migration guide, in progress, that covers this #9557 To use the new VQE, based on the new Estimator primitives, it has to be imported explicitly from the new location. At some future point we can consider having the import from qiskit.algorithms point to the new VQE, but its way to soon to do that.

@woodsp-ibm woodsp-ibm closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2023
@gorkamunoz
Copy link

Hi! Maybe it would be useful to have a warning when importing from minimum_eigen_solvers stating that it is deprecated and that the VQE from minimum_eigensolvers should be used instead?

@woodsp-ibm
Copy link
Member

woodsp-ibm commented Apr 5, 2023

This will happen in the upcoming release. Up until now it was pending deprecation so unless you enabled seeing such warnings you would normally not notice. https://github.com/Qiskit/qiskit-terra/blob/7dc7a1cc7111b80f6cb7eea6de867e36db3ab1a8/qiskit/algorithms/minimum_eigen_solvers/vqe.py#L130-L136

As from 0.24.0 you will see a deprecated message. You can see this change in #9883 which switches the warning type to deprecated. If you look for VQE among the files changed you will see if refers the user to the new one and the migration guide. (as per below from the decorator args there)

        additional_msg=(
            "Instead, use the class ``qiskit.algorithms.minimum_eigensolvers.VQE``. "
            "See http://qisk.it/algo_migration for a migration guide."
        ),
        since="0.24.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mod: algorithms Related to the Algorithms module
Projects
None yet
Development

No branches or pull requests

3 participants