skope-rules icon indicating copy to clipboard operation
skope-rules copied to clipboard

sklearn.externals.six is Deprecated in Sklearn 0.23

Open TomLaMantia opened this issue 3 years ago • 8 comments

Since sklearn.externals.six is deprecated as of version 0.23 (https://github.com/scikit-learn/scikit-learn/pull/12916/files), a fresh install of skopes with the latest version of sklearn will yield the following error:

ImportError: cannot import name 'six'

when running from skrules import SkopeRules, on line 12 of skope_rules.py.

Would it make sense to rely on the official version of six as the documentation suggests? If this is something the community is interested in, I'd be happy to open a PR.

The usage of six seems to be extremely minimal in this project, so the PR seems straightforward, assuming that I am not overlooking any complexities?

TomLaMantia avatar Jul 06 '20 20:07 TomLaMantia

Agreed this is a simple fix that should be implemented!

I made a quick fix at this repo in the meantime. It's runnable with pip install git+https://github.com/csinva/interpretability-implementations-demos and then from imodels import SkopeRules.

csinva avatar Aug 24 '20 19:08 csinva

thanks for reporting, don't hesitate to open a PR fixing this

ngoix avatar Aug 30 '20 13:08 ngoix

@ngoix I believe I do not have write permissions to create a new branch for this.

TomLaMantia avatar Aug 31 '20 12:08 TomLaMantia

you need to clone this repo and create your branch on your clone - same as described in scikit-learn how to contribute

ngoix avatar Sep 01 '20 10:09 ngoix

@ngoix thanks! PR is open now: https://github.com/scikit-learn-contrib/skope-rules/pull/46

TomLaMantia avatar Sep 01 '20 13:09 TomLaMantia

Hi, this bug is still happening in the last version available in PyPi (1.0.1) It's not happening when installing from github though

LuisBlanche avatar Apr 01 '21 15:04 LuisBlanche

I'd be happy to assist with a PiPy deployment if that would be helpful to the project?

TomLaMantia avatar Apr 01 '21 17:04 TomLaMantia

Hi, we also had the same issue now. A way arround can be found here: https://stackoverflow.com/questions/61867945/python-import-error-cannot-import-name-six-from-sklearn-externals

Before importing something you can do: import six import sys sys.modules['sklearn.externals.six'] = six

A solution proposed in there for developer of sklearn seems to be Replace "from sklearn.externals import six" by "import six"

Is somebody going to fix that at some point because it is really confusing to download a package and it initially does not work.

Best regards, David

DaBeIDS avatar Aug 11 '22 13:08 DaBeIDS