Jupyter: No module named 'imblearn" after installation

帅比萌擦擦* 提交于 2020-01-13 08:59:07

问题


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?


回答1:


Problems importing imblearn python package on ipython notebook

Found the answer here. This worked for me

conda install -c glemaitre imbalanced-learn



回答2:


This worked for me:

!pip install imblearn

Then, I was able to import SMOTE package.

from imblearn.over_sampling import SMOTE



回答3:


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:


Just check if you antivirus or firewall is blocking the download process. I too had the same issue. This happens when you try to install through Anaconda. During the installation process there occurs a permission error. This is probably due to antivirus blocking the download process.




回答5:


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.




回答6:


conda install -c conda-forge imbalanced-learn 

It just worries down the problem



来源:https://stackoverflow.com/questions/47606873/jupyter-no-module-named-imblearn-after-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!