cosanlab / nltools

Python toolbox for analyzing imaging data
https://nltools.org
MIT License
121 stars 44 forks source link

No module named 'sklearn.linear_model.base' on Brain_Data import #400

Closed kylestanley1313 closed 1 year ago

kylestanley1313 commented 2 years ago

When importing the Brain_Data class from nltools.data I get a ModuleNotFoundError for sklearn.linear_model.base.

Steps to Reproduce

Python version: 3.9.7

Package versions:

scikit-learn==1.0.1
nltools==0.4.5

Current Behavior

Screen Shot 2021-10-29 at 8 16 31 AM

Expected Behavior

Successful import

Other Notes

The latest version of scikit-learn has a klearn.linear_model._base module, but not a klearn.linear_model.base module.

ejolly commented 2 years ago

Hi @kylestanley1313 it looks like it's due to your using an older version of nilearn. They made a fix a few versions ago to handle the new sklearn API. Since this is an issue with an upstream dependency of ours rather than an ntools issue per se, your best bet is upgrading your nilearn and trying again. Not quite sure how your dependencies got out of sync.

If I install the latest version of nltools in a new environment or computer (e.g. Google Collab) I can't reproduce this issue and our tests don't seem to catch it either.

kylestanley1313 commented 2 years ago

That did the trick. Thanks @ejolly!

For what it's worth, I was hitting that issue with nilearn==0.6.2 and the requirements for this project list nilearn>=0.6.0. Maybe that should be updated?

Kishanji0319 commented 4 weeks ago

I also face this error but when i tried this method whenever faced this problem! Anyone can help me to get out from this error.