Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'imblearn'

I tried running the following code:

from imblearn import under_sampling, over_sampling
from imblearn.over_sampling import SMOTE

sm = SMOTE(random_state=12, ratio = 1.0)
x_SMOTE, y_SMOTE = sm.fit_sample(X, y) 

which gives me the error message:

ModuleNotFoundError: No module named 'imblearn'

I have tried installing the imblearn module in multiple ways, they all seem to work (there are no errors given during the installation but when I run the above code, I get an error message).

I tried istalling imblearn using the following suggested in other stackoverflow questions:

pip install -U imbalanced-learn
pip install imblearn
!pip install imblearn
pip install -c glemaitre imbalanced-learn
pip install imblearn==0.0

None of these seem to help... Any ideas? Thank you!

like image 719
bernando_vialli Avatar asked May 16 '18 17:05

bernando_vialli


1 Answers

On AWS SageMaker, follow the documentation:

!pip install imbalanced-learn

in a notebook cell.

like image 131
Marcus Lauritsen Avatar answered Sep 22 '22 14:09

Marcus Lauritsen