automl / auto-sklearn

Automated Machine Learning with scikit-learn
https://automl.github.io/auto-sklearn
BSD 3-Clause "New" or "Revised" License
7.66k stars 1.28k forks source link

scikit-learn version bug when importing auto-sklearn #1060

Open KyuhwanYeon opened 3 years ago

KyuhwanYeon commented 3 years ago

Describe the bug

Please describe the bug you're experiencing is precise as possible. In order to use auto-sklearn in kaggle environment, I successfully intalled it. However, It shows the error when it is imported.

Firstly, I want to share scikit-learn and auto-sklearn package version in my kaggle environment

import sklearn
!pip show scikit-learn
!pip show auto-sklearn
import autosklearn.regression ## Auto ML package
Name: scikit-learn
Version: 0.24.0
Summary: A set of python modules for machine learning and data mining
Home-page: http://scikit-learn.org
Author: None
Author-email: None
License: new BSD
Location: /opt/conda/lib/python3.7/site-packages
Requires: threadpoolctl, joblib, numpy, scipy
Required-by: yellowbrick, Wordbatch, wfdb, vecstack, umap-learn, tsfresh, TPOT, smac, sklearn, sklearn-pandas, sklearn-contrib-py-earth, shap, scikit-plot, scikit-optimize, scattertext, rgf-python, pysal, PDPbox, nilearn, mlxtend, mapclassify, lime, lightgbm, lightfm, librosa, kmodes, kmapper, keras-tuner, imbalanced-learn, hypertools, hpsklearn, hmmlearn, hep-ml, gplearn, fastai, fancyimpute, eli5, chainer-chemistry, cesium, category-encoders, catalyst, Boruta, bayesian-optimization, autogluon.core, auto-sklearn, allennlp
Name: auto-sklearn
Version: 0.12.1
Summary: Automated machine learning.
Home-page: https://automl.github.io/auto-sklearn
Author: Matthias Feurer
Author-email: feurerm@informatik.uni-freiburg.de
License: BSD
Location: /opt/conda/lib/python3.7/site-packages
Requires: scipy, ConfigSpace, numpy, pyyaml, setuptools, pyrfr, distributed, pandas, liac-arff, smac, joblib, pynisher, dask, scikit-learn
Required-by: 

Then, If I tried to import auto-sklearn import autosklearn.regression ## Auto ML package The result :

---------------------------------------------------------------------------
IncorrectPackageVersionError              Traceback (most recent call last)
<ipython-input-15-5994a3903e7c> in <module>
      5 get_ipython().system('pip show scikit-learn')
      6 get_ipython().system('pip show auto-sklearn')
----> 7 import autosklearn.regression ## Auto ML package

/opt/conda/lib/python3.7/site-packages/autosklearn/__init__.py in <module>
     11 requirements = requirements.decode('utf-8')
     12 
---> 13 dependencies.verify_packages(requirements)
     14 
     15 if os.name != 'posix':

/opt/conda/lib/python3.7/site-packages/autosklearn/util/dependencies.py in verify_packages(packages)
     23             operation = match.group('operation1')
     24             version = match.group('version1')
---> 25             _verify_package(name, operation, version)
     26         else:
     27             raise ValueError('Unable to read requirement: %s' % package)

/opt/conda/lib/python3.7/site-packages/autosklearn/util/dependencies.py in _verify_package(name, operation, version)
     60     if not check:
     61         raise IncorrectPackageVersionError(name, installed_version, operation,
---> 62                                            required_version)
     63 
     64 

IncorrectPackageVersionError: found 'scikit-learn' version 0.23.2 but requires scikit-learn version >=0.24.0

I can't understand why found 'scikit-learn' version 0.23.2 but requires scikit-learn version >=0.24.0 Because, in the kaggle environment, scikit-learn=0.24 not 0.23.2

mfeurer commented 3 years ago

I'm sorry, I haven't seen an issue like this before. I don't know how to debug Kaggle kernels, so I'm afraid that I cannot really help. Would uninstalling and re-installing scikit-learn be an option?

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs for the next 7 days. Thank you for your contributions.

github-actions[bot] commented 3 years ago

This issue has been automatically closed due to inactivity.

karakastarik commented 3 years ago

I have faced the same issue. Is there any solution? Thanks.

eddiebergman commented 3 years ago

Hi @karakastarik,

Could you please provide more information:

MikeTuomas commented 3 years ago

Hi,

I ran into same problem in Kaggle.

https://www.kaggle.com/mikaelovaska/scikit-learn-version-bug-with-auto-sklearn/

You can fork the notebook to try by yourself.

pip freeze and sklearn.__version__ show that installed version of scikit-learn is 0.24.2, but anyway it runs to IncorrectPackageVersionError: found 'scikit-learn' version 0.23.2 but requires scikit-learn version >=0.24.0

After restarting it works, but this bug stops me from running notebooks to the limit of 9 hours.

eddiebergman commented 3 years ago

I'm not sure why this occurs to be honest, thank you for the notebook. I will try to look into it but local installs of auto-sklearn seems to work without issue. I feel this is a kaggle dependant issue with re-using environments but I really can't be sure.

hadaev8 commented 2 years ago

Same problem

gkaretka commented 2 years ago

Same problem here.

import sklearn
print(sklearn.__version__)

returns: 0.24.0

but

import autosklearn.classification

returns: IncorrectPackageVersionError: found 'scikit-learn' version 0.23.2 but requires scikit-learn version >=0.24.0

eddiebergman commented 2 years ago

Just a note for future considerations of this issue. I've read a few times now that jupyter and virtual environments don't iteract well if jupyter is not installed in the venv. I'm not sure we can do much here other than add an FAQ on how to debug and solve this

paulperry commented 1 year ago

auto-sklearn 0.15.0 requires scikit-learn<0.25.0,>=0.24.0, but you have scikit-learn 1.2.2 which is incompatible.

Is there a move to scikit-learn > 1.0 ?

paulperry commented 1 year ago

I did find a way to install auto-sklearn on Kaggle, and it worked: I was able to get scikit-learn==1.2.2 and auto-sklearn ==0.15.0 and was able to :

import sklearn
import autosklearn
import autosklearn.classification

does it work? Errr ... no.