-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Describe the bug
Over the last few days, users have reported issues after installing imbalanced-learn
(e.g. #723, #725, #726)
TL;DR: Users with systems that build based on setup.py
experience errors.
Steps/Code to Reproduce
Set up an environment to imitate a user who currently has scikit-learn==0.22.1
:
$ conda create -n test python=3.7
$ conda activate test
$ pip install scikit-learn==0.22.1
Collecting scikit-learn==0.22.1
Using cached scikit_learn-0.22.1-cp37-cp37m-manylinux1_x86_64.whl (7.0 MB)
...
Versions
System, Dependency Information
System Information
- python :
3.7.7 (default, May 7 2020, 21:25:33) [GCC 7.3.0]
- executable:
/home/hayesall/miniconda3/envs/test/bin/python
- machine :
Linux-5.3.0-59-generic-x86_64-with-debian-buster-sid
Python Dependencies
- pip :
20.0.2
- setuptools:
47.1.1.post20200604
- imblearn :
0.7.0
- sklearn :
0.22.1
- numpy :
1.18.5
- scipy :
1.4.1
- Cython :
None
- pandas :
None
- keras :
None
- tensorflow:
None
- joblib :
0.15.1
Case 1: Installing with pip
These are the default paths on my system:
>>> import sys
>>> for entry in sys.path:
... print(entry)
/home/hayesall/miniconda3/envs/test/lib/python37.zip
/home/hayesall/miniconda3/envs/test/lib/python3.7
/home/hayesall/miniconda3/envs/test/lib/python3.7/lib-dynload
/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages
Installing imbalanced-learn
with pip on Ubuntu uses the wheel from PyPi:
$ pip install imbalanced-learn
...
Collecting scikit-learn>=0.23
Downloading scikit_learn-0.23.1-cp37-cp37m-manylinux1_x86_64.whl (6.8 MB)
... (it correctly upgrades scikit-learn)
And the paths appear correct following installation:
>>> import sys
>>> for entry in sys.path:
... print(entry)
/home/hayesall/miniconda3/envs/test/lib/python37.zip
/home/hayesall/miniconda3/envs/test/lib/python3.7
/home/hayesall/miniconda3/envs/test/lib/python3.7/lib-dynload
/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages
Case 2: Installing with setup.py
Again, these seem to be the default paths on my system:
>>> import sys
>>> for entry in sys.path:
... print(entry)
/home/hayesall/miniconda3/envs/test/lib/python37.zip
/home/hayesall/miniconda3/envs/test/lib/python3.7
/home/hayesall/miniconda3/envs/test/lib/python3.7/lib-dynload
/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages
But now, installing imbalanced-learn
with setup.py
git clone git@github.com:scikit-learn-contrib/imbalanced-learn.git
cd imbalanced-learn
python setup.py install
Summary of the install log
running install
running bdist_egg
running egg_info
writing imbalanced_learn.egg-info/PKG-INFO
writing dependency_links to imbalanced_learn.egg-info/dependency_links.txt
writing requirements to imbalanced_learn.egg-info/requires.txt
writing top-level names to imbalanced_learn.egg-info/top_level.txt
reading manifest file 'imbalanced_learn.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'CONTRIBUTING.ms'
writing manifest file 'imbalanced_learn.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/imblearn
...
creating 'dist/imbalanced_learn-0.7.0-py3.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing imbalanced_learn-0.7.0-py3.7.egg
creating /home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages/imbalanced_learn-0.7.0-py3.7.egg
Extracting imbalanced_learn-0.7.0-py3.7.egg to /home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages
Adding imbalanced-learn 0.7.0 to easy-install.pth file
Installed /home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages/imbalanced_learn-0.7.0-py3.7.egg
Processing dependencies for imbalanced-learn==0.7.0
Searching for scikit-learn>=0.23
Reading https://pypi.org/simple/scikit-learn/
Downloading https://files.pythonhosted.org/packages/b8/7e/74e707b66490d4eb05f702966ad0990881127acecf9d5cdcef3c95ec6c16/scikit_learn-0.23.1-cp37-cp37m-manylinux1_x86_64.whl#sha256=0e7b55f73b35537ecd0d19df29dd39aa9e076dba78f3507b8136c819d84611fd
Best match: scikit-learn 0.23.1
Processing scikit_learn-0.23.1-cp37-cp37m-manylinux1_x86_64.whl
Installing scikit_learn-0.23.1-cp37-cp37m-manylinux1_x86_64.whl to /home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages
Adding scikit-learn 0.23.1 to easy-install.pth file
Installed /home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages/scikit_learn-0.23.1-py3.7-linux-x86_64.egg
This method creates three new entries under site-packages
:
>>> import sys
>>> for entry in sys.path:
... print(entry)
/home/hayesall/miniconda3/envs/test/lib/python37.zip
/home/hayesall/miniconda3/envs/test/lib/python3.7
/home/hayesall/miniconda3/envs/test/lib/python3.7/lib-dynload
/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages
/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages/imbalanced_learn-0.7.0-py3.7.egg
/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages/scikit_learn-0.23.1-py3.7-linux-x86_64.egg
/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages/threadpoolctl-2.1.0-py3.7.egg
... but does not appear to properly clean up the old scikit-learn
version:
>>> import sklearn
>>> sklearn.__version__
'0.22.1'
>>> sklearn.__file__
'/home/hayesall/miniconda3/envs/test/lib/python3.7/site-packages/sklearn/__init__.py'
It looks like something during setup is creating an easy-install.pth
with the following contents:
./imbalanced_learn-0.7.0-py3.7.egg
./scikit_learn-0.23.1-py3.7-linux-x86_64.egg
./threadpoolctl-2.1.0-py3.7.egg