Can't use imbalanced-learn

Hi.
I successfully installed imbalanced learn (https://imbalanced-learn.readthedocs.io/en/stable/) as a user, but when I try to import it, I get following error:
ModuleNotFoundError: No module named ‘sklearn.neighbors._base’

Hi Toni,

I have recently been having troubles importing imblearn, too.
What I did to solve the problem, if i remember correctly, was selecting the environment 96 python 3 from the dropdown menu when logging into swan, which corrresponds to

source /cvmfs/sft.cern.ch/lcg/views/LCG_96python3/x86_64-centos7-gcc8-opt/setup.sh

If i am not mistaken.
Then, in a notebook cell I run

!pip3 install --user imbalanced-learn==0.5

This installed a version of imblearn that “worked in my environment”.
Then I could just import imblearn.
Other versions of imblearn, or other packages, or other environments (I have to be honest, I did not write down the tests I did), had troubles finding some sklearn modules.

Hope this helps

Dario

Hi Dario.
This works for me.
Thank you very much for your help.