CERN Accelerating science

Can't use imbalanced-learn

I successfully installed imbalanced learn ( 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/

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


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