setuptools: [BUG] release v65.6.0 breaks packages downstream due to removal of `distutils.log.Log`
setuptools version
65.6.0
Python version
Python 3.10
OS
Ubuntu
Additional environment information
No response
Description
The distutils.log.Log
class was removed in https://github.com/pypa/setuptools/commit/74652cabdeaacadc76ccf126563bed8ee2ccf3ef. This causes popular packages downstream, such as numpy
, to fail: see https://github.com/numpy/numpy/issues/22623
Expected behavior
The module distutils.log
module was not officially marked as deprecated even though https://github.com/pypa/setuptools/commit/74652cabdeaacadc76ccf126563bed8ee2ccf3ef added to the docstring that the module is Retained for compatibility and should not be used.
. It would be great if the removed class could be reinstated and a deprecation pathway be provided.
How to Reproduce
pip install setuptools==65.6.0
from numpy.distutils import Log
Output
In [4]: from numpy.distutils import Log
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-f8e71815afcd> in <module>
----> 1 from numpy.distutils import Log
~/.virtualenvs/aiida_dev/lib/python3.9/site-packages/numpy/distutils/__init__.py in <module>
22 # Must import local ccompiler ASAP in order to get
23 # customized CCompiler.spawn effective.
---> 24 from . import ccompiler
25 from . import unixccompiler
26
~/.virtualenvs/aiida_dev/lib/python3.9/site-packages/numpy/distutils/ccompiler.py in <module>
18 from distutils.version import LooseVersion
19
---> 20 from numpy.distutils import log
21 from numpy.distutils.exec_command import (
22 filepath_from_subprocess_output, forward_bytes_to_stdout
~/.virtualenvs/aiida_dev/lib/python3.9/site-packages/numpy/distutils/log.py in <module>
2 import sys
3 from distutils.log import * # noqa: F403
----> 4 from distutils.log import Log as old_Log
5 from distutils.log import _global_log
6
ImportError: cannot import name 'Log' from 'distutils.log' (/home/sph/.virtualenvs/aiida_dev/lib/python3.9/site-packages/setuptools/_distutils/log.py)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 36
- Comments: 24 (4 by maintainers)
Commits related to this issue
- Pin setuptools in GA, see pypa/setuptools#3693 — committed to skirpichev/diofant by skirpichev 2 years ago
- Pin setuptools in GA, see pypa/setuptools#3693 — committed to diofant/diofant by skirpichev 2 years ago
- fix unable to install due to setuptools conflicts setuptools == 65.6.0 remove `distutils.log.Log`, this leads to numpy issues see https://github.com/pypa/setuptools/issues/3693 — committed to ZhiyuanChen/scs-python by ZhiyuanChen 2 years ago
- fix unable to install due to setuptools conflicts (#65) setuptools == 65.6.0 remove `distutils.log.Log`, this leads to numpy issues see https://github.com/pypa/setuptools/issues/3693 — committed to bodono/scs-python by ZhiyuanChen 2 years ago
- MNT: Pin setuptools maxversion to workaround numpy/numpy#22623 and pypa/setuptools#3693 — committed to pllim/astropy by pllim 2 years ago
- MNT: Pin setuptools maxversion to workaround numpy/numpy#22623 and pypa/setuptools#3693 though I know this is ugly. — committed to pllim/astropy by pllim 2 years ago
- pin setuptools version in python_module_dependency_using_a_native_extension test This CL ensures our test app does not pull in the latest setuptools as they pushed a bad release that is incompatible ... — committed to GoogleCloudPlatform/buildpacks by matthewrobertson 2 years ago
- Restrict setuptools version The most canonical documention of the issue I could find: https://github.com/pypa/setuptools/issues/3693 Also adds a dependency on `wheels` to silence some pip warnings. ... — committed to mpcusack-color/ssw-py by mpcusack-color 2 years ago
- Use SETUPTOOLS_USE_DISTUTILS=stdlib for newer setuptools * removal of distutils.log.Log from setuptools breaks building packages like numpy. See https://github.com/pypa/setuptools/issues/3693 * w... — committed to neuronsimulator/nrn by pramodk 2 years ago
- Use SETUPTOOLS_USE_DISTUTILS=stdlib for newer setuptools (#2099) * removal of distutils.log.Log from setuptools breaks building packages like numpy. See https://github.com/pypa/setuptools/issues/... — committed to neuronsimulator/nrn by pramodk 2 years ago
- Revert "Pin setuptools in GA, see pypa/setuptools#3693" This reverts commit 2fbb6e54abdc263bb084eba6f9290798533efdd8. — committed to diofant/diofant by skirpichev 2 years ago
- DevOps: Unpin version of `setuptools` This reverts commit 865c30efca580b1155f057e4690d420f3ff0983c. The bug has been fixed in `setuptools==65.6.2`, see: https://github.com/pypa/setuptools/issues/3693 — committed to sphuber/aiida-core by sphuber 2 years ago
- DevOps: Unpin version of `setuptools` This reverts commit 865c30efca580b1155f057e4690d420f3ff0983c. The bug has been fixed in `setuptools==65.6.2`, see: https://github.com/pypa/setuptools/issues/3693 — committed to sphuber/aiida-core by sphuber 2 years ago
- DevOps: Unpin version of `setuptools` This reverts commit 865c30efca580b1155f057e4690d420f3ff0983c. The bug has been fixed in `setuptools==65.6.2`, see: https://github.com/pypa/setuptools/issues/3693 — committed to sphuber/aiida-core by sphuber 2 years ago
- DevOps: Unpin version of `setuptools` This reverts commit 865c30efca580b1155f057e4690d420f3ff0983c. The bug has been fixed in `setuptools==65.6.2`, see: https://github.com/pypa/setuptools/issues/3693 — committed to sphuber/aiida-core by sphuber 2 years ago
- Pin setuptools to at least 65.6.3 Hitting problem in azure when deploying related to distutils removal of log. Used in scikit-build https://github.com/pypa/setuptools/issues/3693 — committed to phcerdan/SGEXT by phcerdan a year ago
export SETUPTOOLS_USE_DISTUTILS=stdlib
appears to be another workaround, which allowed me then to build/installscipy==1.4.1
on ARM (where there are no prebuilt binaries).@bentheiii 's alternative above of
pip install --no-build-isolation scipy==1.4.1
after pinning back setuptools was the only other way I got to work so far.I’ve cut a release 65.6.2 with the fix. Sorry it took so long to get a remedy out. That was mainly my fault. Huge thanks to abravalheri for multiple fixes and validation work.
Thank you all for reporting the problem, in https://github.com/pypa/distutils/pull/192 I am proposing a backfill for the appreciation of
pypa/distutils
maintainers. If accepted, this patch will find its way into setuptools.Note that is still something that needs to be debated in
pypa/distutils
, since in https://github.com/pypa/setuptools/issues/2372 the numpy maintainers agreed with setuptools strategy of makingSETUPTOOLS_USE_DISTUTILS=local
the default behaviour.Also note that the recommendation from the numpy team for everyone using
numpy.distutils
is the following:There should probably be a distinction between building numpy (with pinned setuptools) in CI, versus building a carefully crafted test case that depends on numpy and setuptools, and does
from numpy.distutils import ...
.The latter is what really needs to be tested here in order to make sure that yet more projects using numpy.distutils are operational.
Running into this for statsmodels==0.13.0 and numpy==1.22.0
@bentheiii I’m running into this from numpy 1.19.4 also. what do I need to downgrade 1.1.15 to? we are supposed to be on setuptools==53.0.0 but still running into this somehow started recently…
Thanks @jaraco @abravalheri !
(FWIW @tulbureandreit , I’m also building Docker images, though using pip rather than poetry. Setting the env var with ENV is what I’m doing so that it applies to any and all pip installs.)
This actually breaks just importing
numpy.distutils
altogether: