0
$\begingroup$

I'm trying to import the following elements:

from qiskit_nature.algorithms import (GroundStateEigensolver, NumPyMinimumEigensolverFactory)

But it shows the error: AttributeError: module 'sklearn.metrics._dist_metrics' has no attribute 'DistanceMetric32'

This error didn't appear a few weeks ago. I wonder how to solve this problem. Thanks for your helping!

$\endgroup$

1 Answer 1

1
$\begingroup$

In a fresh environment with qiskit-nature 0.5.2 in it, I get the following deprecation message:

>>> from qiskit_nature.algorithms import (GroundStateEigensolver, NumPyMinimumEigensolverFactory)
<stdin>:1: NatureDeprecationWarning: The qiskit_nature.algorithms.excited_state_solvers package is deprecated as of version 0.5.0 and will be removed no sooner than 3 months after the release. Instead use the qiskit_nature.second_q.algorithms.excited_state_solvers package.
<stdin>:1: NatureDeprecationWarning: The qiskit_nature.algorithms.pes_sampler package is deprecated as of version 0.5.0 and will be removed no sooner than 3 months after the release . Please refer to 'https://github.com/Qiskit/qiskit-nature/issues/750' for additional information regarding 'extrapolators'.

I get the same message when installing from the current git repository.

Based on the error, it might be you downgrade a dependency, scikit-learn in particular. You can check it out with pip show scikit-learn. I'm running scikit-learn 1.2.1 and it works.

$\endgroup$
2
  • $\begingroup$ I use "qiskit-nature 0.5.2" and "scikit-learning 1.2.1" now. But a new bug appears, "ImportError: cannot import name 'class_likelihood_ratios' from 'sklearn.metrics._classification' ". $\endgroup$
    – 劉承瀚
    Feb 22, 2023 at 13:54
  • $\begingroup$ that's still a scikit-learn error. You might want to redo your environment or submit an issue to github.com/scikit-learn/scikit-learn/issues $\endgroup$
    – luciano
    Feb 22, 2023 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.