Issue with sklearn import


Code Issue:
from sklearn import cross_validation

ImportError: cannot import name ‘cross_validation’ from ‘sklearn’ (/anaconda3/lib/python3.7/site-packages/sklearn/

I did try to google this before posting, so mea culpa is this has already been addressed somewhere and I just missed it or didn’t understand it. Some folks said uninstalling and reinstalling sklearn was key, but I’m not sure how to even do that on my mac, plus I don’t recall doing any pip installs in the first place since I’m using a web-based notebook… what am I missing?



Since you are using conda, you might try:

conda upgrade scikit-learn

it sounds like the environment that Jupyter is installed in is different from the environment that scikit-learn is installed in - I often run into path issues like this when that is the case, I think following @minrk 's advice would work! (or before anything run conda install jupyter notebook jupyterlab scikit-learn to ensure they’re all installed in the same environment)