简体   繁体   中英

ImportError: cannot import name 'logsumexp' when importing sklearn.model_selection

I was trying to import sklearn.model_selection with Jupiter Notebook under anaconda environment with python 3.5, but I was warned that I didn't have "model_selection" module, so I did conda update scikit-learn .

After that, I received a message of ImportError: cannot import name 'logsumexp' when importing sklearn.model_selection .

I reinstalled sklearn and scipy , but still received the same error message. May I have some advice?

I came across exactly the same problem just now. After I updated scikit-learn and tried to import sklearn.model_selection , the ImportError appeared.

I just restarted anaconda and ran it again.

It worked. Don't know why.

It's not the best solution, but rolling back to 0.18.2 worked for me (after trying all above-mentioned solutions):

pip uninstall scikit-learn
pip install scikit-learn==0.18.2

Ultimately, it worked with version 0.18.2 of scikit-learn and version 1.2.0 of scipy.

Had the same error. I am using Anaconda. Updating every involved package via pip and conda solved the problem.

pip install scikit-learn --upgrade
pip install scipy --upgrade
pip install sklearn --upgrade

and

conda update scikit-learn
conda update scipy

The same error appeared when I tried to import hmm from hmmlearn, I reinstalled scipy and it worked. Hope this can be helpful.(I have tried updating all of the packages involved to solve the problem, but did not work. My computer system is ubuntu 16.04, with anaconda3 installed.)

In my case the following versions resolve the issue:

scikit-learn==0.18.2
scipy==1.2.0

Just closed the Spyder editor and restarted. This Issue got fixed.

uninstall sci-kit-learn and scipy than install

scikit-learn==0.18.2 scipy==1.2.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM