ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base'
Question:
I am trying to do Missforest as a method for handling missing values in table data.
import sklearn
print(sklearn.__version__)
->1.2.1
import sklearn.neighbors._base
import sys
sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base
!pip install missingpy
from missingpy import MissForest
It was working fine until now, but since yesterday, the following error message has appeared.
ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base'
I would like to know how to deal with this error.
Answers:
the same thing happened to me, I changed the versions of the packages. I have the following setting and it works for me: scikit-learn = 1.1.2, scipy = 1.9.1, missingpy = 0.2.0.
You could use pipwin
to install the appropriate build for your operating system and specific Python version:
Steps:
-
Uninstall current version of sklearn:
pip uninstall scikit-learn -y
-
Install pipwin:
pip install pipwin
-
Install sklearn using pipwin:
pipwin install scikit-learn
I am trying to do Missforest as a method for handling missing values in table data.
import sklearn
print(sklearn.__version__)
->1.2.1
import sklearn.neighbors._base
import sys
sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base
!pip install missingpy
from missingpy import MissForest
It was working fine until now, but since yesterday, the following error message has appeared.
ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base'
I would like to know how to deal with this error.
the same thing happened to me, I changed the versions of the packages. I have the following setting and it works for me: scikit-learn = 1.1.2, scipy = 1.9.1, missingpy = 0.2.0.
You could use pipwin
to install the appropriate build for your operating system and specific Python version:
Steps:
-
Uninstall current version of sklearn:
pip uninstall scikit-learn -y
-
Install pipwin:
pip install pipwin
-
Install sklearn using pipwin:
pipwin install scikit-learn