Skip to content

joblib development version breaks sklearn.show_versions() #22614

Closed
@lesteve

Description

@lesteve

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:

  1. 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
  1. python -c 'import setuptools; import pip' gives you only a warning about setuptools replacing distutils
  2. importing pip before setuptools 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 to import pip see e.g. https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program or Error with import pip in pip 9.0.2 pypa/pip#5081 (comment)
  3. joblib removed some distutils version classes usage in Bump up dependency versions on the CI config joblib/joblib#1272. As a side-effect distutils is not imported by joblib and so when importing sklearn you are anymore importing distutils (hence setuptools) before `pipand you end up in case 1 with an error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions