14
votes

I'm using numpy and mlrose, and all i have written so far is:

import numpy as np
import mlrose

However, when i run it, it comes up with an error message:

 File "C:\Users\<my username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mlrose\neural.py", line 12, in <module>
    from sklearn.externals import six
ImportError: cannot import name 'six' from 'sklearn.externals' (C:\Users\<my username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sklearn\externals\__init__.py)

Any help on sorting this problem will be greatly appreciated.

2
pip install six should install six and solve the problem - Ashwin Geet D'Sa
That isn't the issue. mlrose is trying to import six from sklearn, you will still get this error if you have six installed. - bcattle

2 Answers

36
votes

Solution: The real answer is that the dependency needs to be changed by the mlrose maintainers.

A workaround is:

import six
import sys
sys.modules['sklearn.externals.six'] = six
import mlrose
1
votes

from sklearn.externals import six is deprecated, use import six instead