Rasa: ImportError: No module named sklearn.model_selection

Created on 13 Feb 2017  路  27Comments  路  Source: RasaHQ/rasa

I followed the steps in the documentation and installed spacy and sickit-learn(using conda). After setting up the backend and trying to train. I get ImportError: No module named sklearn.model_selection. Please see the screenshot.
capture

All 27 comments

Try to change the version of sklearn in
https://github.com/golastmile/rasa_nlu/blob/master/conda-requirements.txt#L2
to 0.18.1 and update your conda, does that help?

Nope. Still the same error.

Are you still experiencing this error? Are you able to import this module in the repl? Maybe uninstall and reinstall

Nope. Well @amn41 let me tell you the whole story. I was trying to install MITIE on Windows 10 but it just won't install. It always gave me the error, "The file specified could not be found". So, I decided to try spacy. It installed successfully. But I wasn't able to use it (Refer to the first post in this thread for screenshot). After wasting 2 days on it, I decided to try linux since my friend told me that he was able to install MITIE successfully on linux. Everything went well on linux. I have setup MITIE on Ubuntu without any problems.

OK yes there's a known issue of MITIE on windows. No idea why sklearn wouldn't work though. Closing this.

@amn41 Please don't close the issue yet. Because I would be very much happy to have rasa working on Windows 10 since I am comfortable with working on Windows. Just tell me what I need to do to get rasa working on Windows 10 either with MITIE or spacy.

@abubakarsohail judging by the error you posted it most likely is a version issue with sklearn.
When you execute smth like
python -c "import sklearn; print sklearn.__version__"
What version gets printed? If that is lower than 0.18, then that is the wrong version.

This is what I got @tmbo. If you think that spacy is not installed, please check the 2nd screenshot.
capture
capture

This seems like the python package is not installed at all. Which commands did you run to install the dependencies?

Please check the screenshot @tmbo. I guess everything looks fine from the installation point of view.
capture

Yes that looks good. And the issue still persists?

I am afraid, it does. Please, have a look at the screenshot.
capture

Can you try installing sklearn with pip instead of anaconda, eg. pip install sklearn

It doesn't work either.
capture
capture

Try installing all the dependencies using pip install -r requirements.txt

@tmbo Is this normal? Please, have a look.
capture
capture
capture

@tmbo Hey, I am still a newbie. So, can you tell me which one's better to use, MITIE or spacy? Also, did you see the screenshots?
@amn41 can you help as well?

Since the installation error is mitie related you can try using spacy first to see if that is working.

Please, have a look at the screenshots @tmbo .
capture
capture
capture
capture

@tmbo @amn41 I did everything from the start. Installed everything from the start. But all in vain. Still stuck at the same position. Can you please help me set up spacy?
capture

Hey @amn41 , since someone else is having the same issue as mine. Can you please help me resolve the issue? I am having the exact same issue.

This seems to be an issue with installing sklearn on windows, and is unrelated to rasa. I would suggest you have a look at the github issues page for scikit-learn.

Do you have two version python?

Hola there,
Sklearn is working there only in windows 10 where have the security of administration applied.
How to get it to work in other directories?

Pls check your file name.
Might be u r saving it with the same name as sklearn,
so everytime u run u will face the same prob.

Python search for the file first within ur directory and if it is not there then only it shifts to its own defined directory.

pip install -U scikit-learn scipy matplotlib

install this library

Hi All!
Getting this error since a week, please help...
from . import __check_build # noqa: F401
ImportError: cannot import name '__check_build' from 'sklearn'

Was this page helpful?
0 / 5 - 0 ratings