Jupyter: No module named 'imblearn" after inst

2020-07-08 07:26发布

I installed "imbalanced-learn" (version 0.3.1) on ANACONDA Navigator. When I ran an example from the imbalanced-learn website using Jupyter (Python 3), I got an message regarding "ModuleNotFoundError". No module named 'imblearn".

from imblearn.datasets import make_imbalance
from imblearn.under_sampling import NearMiss
from imblearn.pipeline import make_pipeline
from imblearn.metrics import classification_report_imbalanced

How could I resolve this?

9条回答
做个烂人
2楼-- · 2020-07-08 07:26

Open Anaconda Prompt and type in

pip install imbalanced-learn --user
查看更多
Animai°情兽
3楼-- · 2020-07-08 07:29

I have faced the same problem and I installed imblearn first by typing this command:

!pip install imblearn  

in jupyter notebook and then it is fine

查看更多
叼着烟拽天下
4楼-- · 2020-07-08 07:30

This worked for me:

!pip install imblearn

Then, I was able to import SMOTE package.

from imblearn.over_sampling import SMOTE
查看更多
看我几分像从前
5楼-- · 2020-07-08 07:31

Problems importing imblearn python package on ipython notebook

Found the answer here. This worked for me

conda install -c glemaitre imbalanced-learn
查看更多
Animai°情兽
6楼-- · 2020-07-08 07:31

I used in this code in my Jupyter Notebook and it works fine.

! pip install imbalanced-learn
查看更多
叼着烟拽天下
7楼-- · 2020-07-08 07:32

Just in case someone encounters this problem on Google Cloud Jupyter notebook instances, using pip3 to install imblearn made it work for me, after failing with pip command:

pip3 install imblearn

or directly in the notebook:

!pip3 install imblearn

You should see imblearn (0.0) and imbalanced-learn (4.3) in your pip list.

NB! Make sure to reload your notebooks (File -> Close and Shutdown), otherwise it might fail to import the library after install.

查看更多
登录 后发表回答