Closed
Description
When we release joblib (soonish let's say a matter of weeks) we will break sklearn.show_versions()
. We may need to do a bug-fix release of scikit-learn.
To reproduce:
mamba create -n test-env scikit-learn -y
conda activate test-env
pip install git+https://github.com/joblib/joblib
python -c 'import sklearn; sklearn.show_versions()'
This is a mixture of different things:
python -c 'import pip; import setuptools'
breaks
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/lesteve/miniconda3/envs/test/lib/python3.10/site-packages/setuptools/__init__.py", line 8, in <module>
import _distutils_hack.override # noqa: F401
File "/home/lesteve/miniconda3/envs/test/lib/python3.10/site-packages/_distutils_hack/override.py", line 1, in <module>
__import__('_distutils_hack').do_override()
File "/home/lesteve/miniconda3/envs/test/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 72, in do_override
ensure_local_distutils()
File "/home/lesteve/miniconda3/envs/test/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 59, in ensure_local_distutils
assert '_distutils' in core.__file__, core.__file__
AssertionError: /home/lesteve/miniconda3/envs/test/lib/python3.10/distutils/core.py
python -c 'import setuptools; import pip'
gives you only a warning about setuptools replacing distutils- importing
pip
beforesetuptools
breaks and it is considered as a won't fix: [BUG] ensure_local_distutils is failing when pip is imported before setuptools pypa/setuptools#3044. The reason is that you are not supposed toimport pip
see e.g. https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program or Error withimport pip
in pip 9.0.2 pypa/pip#5081 (comment) - joblib removed some
distutils
version classes usage in Bump up dependency versions on the CI config joblib/joblib#1272. As a side-effectdistutils
is not imported byjoblib
and so when importingsklearn
you are anymore importingdistutils
(hencesetuptools
) before `pipand you end up in case 1 with an error