J.Su
J.Su

Reputation: 81

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?

Upvotes: 7

Views: 21026

Answers (5)

orialz
orialz

Reputation: 75

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.

Upvotes: 2

pddwys
pddwys

Reputation: 11

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.)

Upvotes: 1

Braidy916
Braidy916

Reputation: 196

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.

Upvotes: 11

lrsppp
lrsppp

Reputation: 1413

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

Upvotes: 1

Jagannath Banerjee
Jagannath Banerjee

Reputation: 2141

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

Upvotes: 0

Related Questions