Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid deprecation warning from sklearn.externals.six #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Avoid deprecation warning from sklearn.externals.six #50

wants to merge 1 commit into from

Conversation

ksbeattie
Copy link

The changes here should avoid the deprecation warnings from sklearn about its internal six module being deprecated in favor of the "official" six module:

$ python -c "import mlrose"
/Users/ksb/opt/anaconda3/envs/ccsi-foqus/lib/python3.7/site-packages/sklearn/externals/six.py:31: FutureWarning: The module is deprecated in version 0.21 and will be removed in version 0.23 since we've dropped support for Python 2.7. Please rely on the official version of six (https://pypi.org/project/six/).
  "(https://pypi.org/project/six/).", FutureWarning)

I also changed the name used to identify scikit-learn as a requirement to (what I understand to be) the more correct name scikit-learn which avoids the "alias" package sklearn-0.0 from getting installed.

All the tests run by ./test/test.sh still pass with this change, so hopefully this is correct. If not, hopefully this is a hint in the direction on how to avoid the deprecation warning.

Use full name for scikit-learn to avoid sklearn-0.0 package
@ksbeattie
Copy link
Author

@gkhayes, any chance you could take a look at this?

@JohnStratoudakis
Copy link

JohnStratoudakis commented May 26, 2020

I am getting an error when trying to use mlrose as mentioned above:

→ python3.7 -c "import mlrose"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/mlrose/__init__.py", line 12, in <module>
    from .neural import NeuralNetwork, LinearRegression, LogisticRegression
  File "/usr/local/lib/python3.7/site-packages/mlrose/neural.py", line 12, in <module>
    from sklearn.externals import six
ImportError: cannot import name 'six' from 'sklearn.externals' (/usr/local/lib/python3.7/site-packages/sklearn/externals/__init__.py)

And making the first change get's rid of any error occurring during import.

@ksbeattie
Copy link
Author

It seems that scikit-learn has released 0.23.1 and removed six from their sklearn.externals module, so this warning is now an error. Hopefully mlrose will be updated soon as well?

@JohnStratoudakis
Copy link

I downgraded my scikit-learn to version 0.22 and my code is now working again. So my requirements.txt file now has:

scikit-learn==0.22

@arainboldt
Copy link

hi guys, love the package. Any plans to refactor this?

@ksbeattie
Copy link
Author

hi guys, love the package. Any plans to refactor this?

@arainboldt, it appears that mlrose-hiive (a fork of this repo) has done this.

We've moved to using that module now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants