scikit-learn-contrib / skope-rules

machine learning with logical rules in Python
http://skope-rules.readthedocs.io
Other
615 stars 95 forks source link

sklearn.externals.six is Deprecated in Sklearn 0.23 #41

Open TomLaMantia opened 4 years ago

TomLaMantia commented 4 years ago

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?

csinva commented 4 years ago

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.

ngoix commented 4 years ago

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

TomLaMantia commented 4 years ago

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

ngoix commented 4 years ago

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

TomLaMantia commented 4 years ago

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

LuisBlanche commented 3 years ago

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

TomLaMantia commented 3 years ago

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

DaBeIDS commented 2 years ago

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