Psychopy does not recognize scikit-learn

We are trying to import NME and scikit-learn through standalone version of psychopy. We followed the installation described here. We were able to get psychopy to recognize NME via pth method but for scikit-learn we get the following message when we try to import it: no module named “sklearn.pipeline.” We have tried installing both the .whl and tar.gz version of the library to no avail.

To second on the issue above, the preference method doesn’t work for me. I did import psychopy at the beginning, and it says No module named ‘sklearn’ when I import sklearn.

Also, is this page still up to date and still has the restriction of the Python 2.7 version as stated?

When adding MNE, instead of using .pth or preference method, I directly moved the MNE package folder into this directory: ‘/PsychoPy3/Lib/site-packages/’, and it seems to work, while for scikit-learn, there’s no luck. I’ve tried different versions of the sklearn package, but none of them works so far.

@TParsons, would you be able to advise on how to resolve this please?


This has now been resolved. Posting the solution here in case anyone else encounters the same issue -

The sklearn package file was downloaded here. Note that the Python version in our PsychoPy is 3.6.6, therefore a cp36 version sklearn .whl file was used in order to be compatible.The package was then placed in ‘ …/PsychoPy3/Lib/site-packages/ ’.In my case, another error saying that module “joblib” cannot be found after sklearn package was added, so the same procedure was done with joblib, downloaded via this webpage.

After this, I was able to import scikit-learn and use relevant libraries in PsychoPy.
I hope this helps.

1 Like

Thanks for flagging this up! I’ll look into why packages specified in paths aren’t recognised - might be one of the changes we’ve made since 2.7 accidentally knocked that functionality out without us realising. Could you add this as an Issue on GitHub?

Sure, happy to do so. Thanks for looking into this.