Closed sirgeorgesawcon closed 1 year ago
The tutorial has this below to import VQE (this is the new Estimator based VQE)
from qiskit.algorithms.minimum_eigensolvers import VQE
your code above is
from qiskit.algorithms.minimum_eigen_solvers import VQE
which is importing an older VQE from minimum_eigen_solvers
(which is being deprecated in the upcoming release) where there is an _
in eigen_solvers
which the newly located VQE does not have. If you correct the import, so it matches the tutorial, then it will work.
If you look at the old VQE signature its,
class VQE(ansatz=None, optimizer=None, initial_point=None, gradient=None, expectation=None, include_custom=False, max_evals_grouped=1, callback=None, quantum_instance=None)
where you end up passing an estimator instance, where its expecting an ansatz circuit, and it seems the result is the issue you see.
I will go ahead and close this in the absence of any feedback. The above should have solved your issue, in that you need to use the same VQE as the tutorial uses - there is the older legacy one, which I imagine you accidentally used, and the newer primitive based one that uses an Estimator.
Informations
What is the current behavior?
Following the qiskit tutorial exactly Tutorial , I'm getting the error
AttributeError: 'Estimator' object has no attribute 'draw'
Steps to reproduce the problem
Just follow the tutorial as it is, no change in any code blocks
What is the expected behavior?
The code should run without any output.
Suggested solutions
The![issue](https://user-images.githubusercontent.com/63145298/233893839-e842ac71-0db3-48c4-b4c6-5125f0a1919c.png)
vqe.py
file asks forif self.ansatz is not None: --> ret += "{}".format(self.ansatz.draw(output="text"))
thisdraw
is somehow not attributed in the Estimator class.