scikit-learn-intelex
scikit-learn-intelex copied to clipboard
Library crashes on sklearn >= 1.1.0
Describe the bug
Version 2021.5.3 of scikit-learn-intelex
seems incompatible with latest 1.1.1 version of scikit-learn
. Latest scikit-learn
which works is 1.0.2, so I had to downgrade it.
Moreover, I know that scikit-learn-intelex
2021.6.0 is suggested in my upgrades but pip
gives an error every time it tries to download it ( #1003), so I am referring 2021.5.3 as the latest version.
To Reproduce
- Install latest
scikit-learn-intelex
(2021.5.3) andscikit-learn
(1.1.1) - Import it to an existing sklearn python project file
from sklearnex import patch_sklearn
patch_sklearn()
- Run it and obtain this error:
from sklearn.utils.fixes import sparse_lsqr
ImportError: cannot import name 'sparse_lsqr' from 'sklearn.utils.fixes'
Expected behavior Run it without any importing error.
Output/Screenshots None.
Environment:
- OS: Linux Mint 20.3
- Compiler: Python 3.8.10
- Version: 2021.5.3
Hi @gabrielication Thanks a lot for pointing this out. This definitely not expected behavior. I will try to find fix ASAP
Hi @gabrielication Everything seems to work fine for python version=3.10. Could you try running the intel extension for scikit-learn with this version of python?
Hi, I was able to reproduce this issue compiling from source with python 3.8 and python 3.9, but it seems that when using python 3.10 it works. @PivovarA Could you indicate why this doesn't happen with 3.10 ? Is python 3.10 a requirement ?
Hi @gabrielication Everything seems to work fine for python version=3.10. Could you try running the intel extension for scikit-learn with this version of python?
I will try it in the next days, thank you for your work.
Hi @gabrielication and @rafariossaa Finally we have updated the metadata for scikit-learn-intelex, now sklearnex can be installed for python>=3.7.
Hi @gabrielication and @rafariossaa Finally we have updated the metadata for scikit-learn-intelex, now sklearnex can be installed for python>=3.7.
Hi, I confirm that it completely works now. Thank you!
Does this fix require compiling from source?
I just ran into this bug as well trying to do a fresh installation of scikit-learn-intelex today. I installed with the command:
conda create -n scikit-learn-intelex-basic -c conda-forge python=3.9 scikit-learn-intelex
, as suggested here.
This installed scikit-learn-1.1.1 and scikit-learn-intelex-2021.5.0. When I call from sklearnex import patch_sklearn
, I also get the error
from sklearn.utils.fixes import sparse_lsqr
ImportError: cannot import name 'sparse_lsqr' from 'sklearn.utils.fixes' (/opt/anaconda3/envs/scikit-learn-intelex-basic/lib/python3.9/site-packages/sklearn/utils/fixes.py)
OS: MacOS Monterey 12.4 Python 3.9.13
Does this fix require compiling from source?
I just ran into this bug as well trying to do a fresh installation of scikit-learn-intelex today. I installed with the command:
conda create -n scikit-learn-intelex-basic -c conda-forge python=3.9 scikit-learn-intelex
, as suggested here. This installed scikit-learn-1.1.1 and scikit-learn-intelex-2021.5.0. When I callfrom sklearnex import patch_sklearn
, I also get the errorfrom sklearn.utils.fixes import sparse_lsqr ImportError: cannot import name 'sparse_lsqr' from 'sklearn.utils.fixes' (/opt/anaconda3/envs/scikit-learn-intelex-basic/lib/python3.9/site-packages/sklearn/utils/fixes.py)
OS: MacOS Monterey 12.4 Python 3.9.13
Hi,@BethanyL, I had the same problem yesterday, with scikit-learn-intelex-2021.5.0. and python 3.9. And finally I reinstall scikit-learn==1.0.2 fix the problem(scikit-learn-intelex-2021.5.0. + scikit-learn==1.0.2 will work well with python-3.9 also with 3.10).
I'm also running into this. Does this require a new release?
I'm also running into this. Does this require a new release?
Maybe it just because sklearn's version is not math with sklearn-inelex's, downgrade sklearn to 1.0.x, and it may work well.
Fixed in https://github.com/intel/scikit-learn-intelex/pull/980, sklearnex built from source works with sklearn 1.1.1
2021.6.3. with fix is available in PyPI, but not in conda yet.