Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter: No module named 'imblearn" after installation

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?

like image 786
TTZ Avatar asked Dec 02 '17 10:12

TTZ


People also ask

How do I fix No module named Imblearn?

The Python "ModuleNotFoundError: No module named 'imblearn'" occurs when we forget to install the imbalanced-learn module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install -U imbalanced-learn command.

How do I install Jupyter notebook packages?

Type in jupyter notebook in the terminal. Open a new notebook and import sys . The important step is to add the path of your virtual environment site packages to the system path. The ./ is a relative path and assumes that you are currently in your virtual environment directory.

How do I install imbalanced learning?

From source available on GitHub Use the following commands to get a copy from Github and install all dependencies: git clone https://github.com/scikit-learn-contrib/imbalanced-learn.git cd imbalanced-learn pip install . Be aware that you can install in developer mode with: pip install --no-build-isolation --editable .


1 Answers

This worked for me:

!pip install imblearn

Then, I was able to import SMOTE package.

from imblearn.over_sampling import SMOTE
like image 109
Pratibha Avatar answered Sep 28 '22 17:09

Pratibha