Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lazypredict.Supervised.LazyClassifier. ImportError: Cannot import name '_raise_dep_warning_if_not_pytest' from 'sklearn.utils.deprecation'

I tried:

from lazypredict.Supervised import LazyClassifier

But got the following traceback:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-f518cae57501> in <module>
     10 from sklearn.linear_model import LogisticRegression
     11 from sklearn.ensemble import RandomForestClassifier
---> 12 from lazypredict.Supervised import LazyClassifier
     13 from sklearn.model_selection import GridSearchCV
     14 from sklearn.metrics import accuracy_score

~\AppData\Roaming\Python\Python38\site-packages\lazypredict\Supervised.py in <module>
     14 from sklearn.preprocessing import StandardScaler, OneHotEncoder, OrdinalEncoder
     15 from sklearn.compose import ColumnTransformer
---> 16 from sklearn.utils.testing import all_estimators
     17 from sklearn.base import RegressorMixin
     18 from sklearn.base import ClassifierMixin

S:\anaconda\lib\site-packages\sklearn\utils\testing.py in <module>
      5 from . import _testing  # type: ignore
      6 from ..externals._pep562 import Pep562
----> 7 from ..utils.deprecation import _raise_dep_warning_if_not_pytest
      8 
      9 deprecated_path = 'sklearn.utils.testing'

ImportError: cannot import name '_raise_dep_warning_if_not_pytest' from 'sklearn.utils.deprecation' (S:\anaconda\lib\site-packages\sklearn\utils\deprecation.py)

I was working in a Jupyter notebook, and have already tried upgrading scikit-learn too.

like image 781
Siddharth Avatar asked Oct 21 '25 23:10

Siddharth


1 Answers

This is most likely caused by incompatible versions of lazypredict and scikit-learn. Per the current LazyPredict requirements file, it needs scikit-learn==0.23.1.

This should be fixed with:

pip uninstall scikit-learn -y
pip install scikit-learn==0.23.1
like image 106
Alexander L. Hayes Avatar answered Oct 25 '25 11:10

Alexander L. Hayes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!