Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
4.86k stars 2.29k forks source link

Error importing VQE #10436

Closed cgustin99 closed 1 year ago

cgustin99 commented 1 year ago

Environment

What is happening?

When I import VQE, I get a deprecation warning error message.

How can we reproduce the issue?

from qiskit.algorithms.minimum_eigensolvers import VQE

What should happen?

The error message I get is:

Traceback (most recent call last):
  Cell In[14], line 1
    from qiskit.algorithms.minimum_eigensolvers import VQE
  File /opt/conda/lib/python3.10/site-packages/qiskit/algorithms/__init__.py:238
    from .phase_estimators import (
  File /opt/conda/lib/python3.10/site-packages/qiskit/algorithms/phase_estimators/__init__.py:16
    from .phase_estimation import PhaseEstimation
  File /opt/conda/lib/python3.10/site-packages/qiskit/algorithms/phase_estimators/phase_estimation.py:27
    from .phase_estimation_result import PhaseEstimationResult, _sort_phases
  File /opt/conda/lib/python3.10/site-packages/qiskit/algorithms/phase_estimators/phase_estimation_result.py:23
    class PhaseEstimationResult(PhaseEstimatorResult):
  File /opt/conda/lib/python3.10/site-packages/qiskit/algorithms/phase_estimators/phase_estimation_result.py:76 in PhaseEstimationResult
    def most_likely_phase(self) -> float:
  File /opt/conda/lib/python3.10/site-packages/qiskit/utils/deprecation.py:306 in decorator
  File /opt/conda/lib/python3.10/site-packages/qiskit/utils/deprecation.py:426 in add_deprecation_to_docstring
ValueError: Deprecation messages cannot contain new lines (`\n`), but the deprecation for PhaseEstimationResult.most_likely_phase had them. Usually this happens when using `"""` multiline strings; instead, use string concatenation.

This is a simplification to facilitate deprecation messages being added to the documentation. If you have a compelling reason to need new lines, feel free to improve this function or open a request at https://github.com/Qiskit/qiskit-terra/issues.

Any suggestions?

No response

1ucian0 commented 1 year ago

I just tried it and it looks like working for me.

Screenshot 2023-07-15 at 17 19 46

Maybe try restarting your kernel?

cgustin99 commented 1 year ago

I just tried it and it looks like working for me.

Screenshot 2023-07-15 at 17 19 46

Maybe try restarting your kernel?

This worked, thanks a lot.