I'm working in Jupyter Notebook and using the following versions:

Python 3.11.5, pip 23.2.1, conda 23.7.4, scikit-learn 1.3.0 during both pip3 and conda installations, and imbalanced-learn 0.11.0 in installations via both pip3 and conda as well.

So, after successfully installing imbalanced-learn library via Pip3,

pip install imblearn

when I attempted to import SMOTE algorithm from imblearn.over_sampling module in my Python notebook,

from imblearn.over_sampling import SMOTE

I unexpectedly encountered an Import Error, stating that:

ImportError: cannot import name '_MissingValues' from 'sklearn.utils._param_validation

Fortunately, subsequently un-installing imbalanced-learn and then proceeding to install it again, using Conda this time, resulted in no error from there onwards:

  1. pip uninstall imblearn --yes

  2. conda install -c conda-forge imbalanced-learn

So, after encountering and then resolving this issue, I tried finding out the reason why this happens in the first place. Unfortunately, I found nothing concrete behind this discrepancy. So, why are Conda and Pip different for this?

Thanks in advance.

0

There are 0 best solutions below