Open LaurentBerder opened 3 years ago
second this
Hi guys, thanks for opening this issue.
Indeed, the current version of lazypredict requires that you use the scikit-learn==0.23.1
, because a couple things have changed after the sckit-learn upgrade to version 0.24.
We need to update the lazypredict support of scikit-lean.
I'm planning to do this on the next weeks, but if any of you wanted to give a try, please, let me know and go ahead.
Sorry @brendalf, I admit I wouldn't know how.
I did, however, give a try with scikit-learn==0.23.1
, and hit another issue with scipy version, as it seems only version scipy==1.6.0
is supported. Which assumes only python 3.6
at the highest (I was trying out with python 3.9).
Go to Supervised.py and change this line
from sklearn.utils.testing import all_estimators
to
from sklearn.utils import all_estimators
I did this in my environment and it works fine now.
Go to Supervised.py and change this line
from sklearn.utils.testing import all_estimators
to
from sklearn.utils import all_estimators
I did this in my environment and it works fine now.
How do you go to Supervised.py?
@agupta004 should be in your virtual environment folder:
/envs/<your_environment_name>/lib/python/site-packages/lazypredict/Supervised.py
Go to Supervised.py and change this line
from sklearn.utils.testing import all_estimators
to
from sklearn.utils import all_estimators
I did this in my environment and it works fine now.
This is not the only import causing error. There are many others. I tried fixing them but end up giving up.
If anyone still has this issue, to fix this, I overwrote the contents of ../python3.9/site-packages/lazypredict/Supervised.py
with the contents of the pull request where this issue is fixed but not yet merged https://github.com/shankarpandala/lazypredict/blob/e6e59f0053208326e90e65b67978122bbaeacace/lazypredict/Supervised.py
Then I was able to successfully import it with scikit-learn 0.24.2
I edited the Supervisor.py file as suggested by agupta004, and now I get:
"Traceback (most recent call last):
File "D:/Bioinformatics/Python/Python_for_Bioinformatics_04.py", line 8, in
How can we fix this?
My python is python 3.9, on Windows 10, and my python environment looks like: C:\WINDOWS\system32>pip freeze altgraph==0.17 asgiref==3.3.1 astroid==2.4.2 attrs==21.2.0 backcall==0.2.0 bcrypt==3.2.0 bsddb3 @ file:///C:/Users/xxxx/Downloads/bsddb3-6.2.9-cp39-cp39-win_amd64.whl certifi==2020.12.5 cffi==1.14.4 chardet==4.0.0 chembl-webresource-client==0.10.7 click==7.1.2 colorama==0.4.4 cycler==0.10.0 DateTime==4.3 decorator==4.4.2 Django==3.1.6 easydict==1.9 et-xmlfile==1.1.0 Flask==1.1.2 Flask-Login==0.5.0 Flask-SQLAlchemy==2.4.4 freetype-py==2.2.0 future==0.18.2 idna==2.10 ipython==7.20.0 ipython-genutils==0.2.0 isort==5.7.0 itsdangerous==2.0.1 jedi==0.18.0 Jinja2==2.11.3 joblib==1.0.0 kiwisolver==1.3.1 lazy-object-proxy==1.4.3 lazypredict==0.2.7 llvmlite==0.36.0 lxml==4.6.2 MarkupSafe==1.1.1 matplotlib==3.3.4 mccabe==0.6.1 multitasking==0.0.9 numba==0.53.1 numpy==1.19.5 opencv-python==4.5.2.52 openpyxl==3.0.7 pandas==1.2.1 parso==0.8.1 patsy==0.5.1 pefile==2021.5.24 pickleshare==0.7.5 Pillow==8.1.0 prompt-toolkit==3.0.16 py4j==0.10.9 pycparser==2.20 Pygments==2.8.0 pyinstaller==4.4 pyinstaller-hooks-contrib==2021.2 pylint==2.6.0 pylint-flask==0.6 pylint-flask-sqlalchemy==0.2.0 pylint-plugin-utils==0.6 pyparsing==2.4.7 pyspark==3.1.2 python-dateutil==2.8.1 pytz==2020.5 pywin32-ctypes==0.2.0 PyYAML==5.4.1 requests==2.25.1 requests-cache==0.7.5 rpy2==3.4.2 scikit-learn==0.24.1 scipy==1.6.0 seaborn==0.11.1 six==1.15.0 SQLAlchemy==1.3.23 sqlparse==0.4.1 statsmodels==0.12.2 threadpoolctl==2.1.0 toml==0.10.2 torch==1.7.1 torchvision==0.2.2.post3 tqdm==4.56.2 traitlets==5.0.5 typing-extensions==3.7.4.3 tzlocal==2.1 url-normalize==1.4.3 urllib3==1.26.3 vispy==0.6.6 wcwidth==0.2.5 Werkzeug==1.0.1 wrapt==1.12.1 xlrd==2.0.1 XlsxWriter==1.3.7 yfinance==0.1.55 zope.interface==5.2.0
Edit:
I managed to install xgboost, and lightgbm, but now I am getting this error:
"Traceback (most recent call last):
File "D:/Bioinformatics/Python/Python_for_Bioinformatics_04.py", line 8, in
From your Supervised.py file: "removed_classifiers = [('ClassifierChain', sklearn.multioutput.ClassifierChain), ('ComplementNB', sklearn.naive_bayes.ComplementNB), ('GradientBoostingClassifier', sklearn.ensemble.gradient_boosting.GradientBoostingClassifier),"
So how can I fix this?
Bottom-line, your program has been one colossal waste of my time, why can't you idiots learn how to write robust code?
A bit late to the party, but managed to fix the exact same problem you had @jam-one.
Inside Supervisor.py
, I changed sklearn.ensemble.gradient_boosting.GradientBoostingClassifier
to sklearn.ensemble.GradientBoostingClassifier
. Be advised there will be like 10 more similar adjustments to do for different imported classes.
At the very end, after the issue with classes has been resolved, there was another error:
Traceback (most recent call last):
File "", line 1, in
That one I resolved by changing failing .pop( )
lines as below (the same was needed for CLASSIFIERS):
for i in removed_regressors:
if i in REGRESSORS:
REGRESSORS.pop(REGRESSORS.index(i))
After that it worked fine.
I faced a similar issue with Lazypredict but what @PiotMik suggested solved the issue nicely. After making all the necessary adjustments it will work. In case, you guys are stuck on how to edit Supervised.py, I already had Notepad++ with me so it was easy editing. Once edited it will work fine. I think this issue should be closed now.
@asad-mahmood
As per your suggestion, i have done this but i got the following error :
AttributeError: module 'sklearn.utils' has no attribute '_mocking'
Please guide.
@avijit2403 could you please tell me in which line that error is being shown I would love to help but my Supervised.py doesn't have any such thing and I couldn't find it in sklearn.utils documentation as well. Could you upload ss, I will try to help you if you like.
@avijit2403 yaar I don't have that checking classifier in my removed_classifiers. Try removing that line of code. My removed_classifiers is starting from the classifier chain. I was also not able to find any such thing in sklearn
I think @nina96's suggestion is working fine...Thanks........ @avijit2403 maybe try to remove all the error lines in Supervised.py, then the calculation performing smoothly. Also @brendalf's also right there is an issue on the new version of sci-kit-learn with lazypredict.
Any updates on this?
i have the same problem any update
Hi,
I wanted to give your package a try, but can't. A bit of description of my setup:
I'm getting an error just by importing your package.
It seems to be a discrepancy between the version of SciKit-Learn I have and the one that LazyPredict expects, since the architecture of sklearn is different.
Shouldn't you try to make sure that the expected versions of dependency packages are installed ?