Description
For those landing on this issue, please see:
(thank you @delfick for summarizing this)
- This functionality has been deprecated for 5 years, there is a separate issue for discussing if there would have been a better way of removing the functionality [FR] More gradual breakage of setuptools.command.test #4520
- For people using pip (or tools using pip, like poetry),
PIP_CONSTRAINT
set to a file withsetuptools<72.0
should work- For people using uv, there seems to be a bug where
UV_CONSTRAINT
doesn't affect the version of setuptools used in build isolation (see ModuleNotFoundError: No module named 'setuptools.command.test' astral-sh/uv#5551) and in that case the solution is either--no-build-isolation
(which should be considered a temporary solution) or getting packages to not use setuptools.command.test or using forks of those packages that comment out the use of setuptools.command.test (until setuptools releases a fix/revert)- To press subscribe to the ticket and/or thumbs up the top post instead of adding "same" comments
Quoted from #4519 (comment)
setuptools version
setuptools==72.0.0
Python version
Python 3.9
OS
Linux
Additional environment information
No response
Description
The breakage change released on 72.0 breaks the default build isolation build of many packages since many of these packages do not pin on a particular setuptools version.
There is also no way to pin to an older setuptools version as pip doesn't offer a way to do this. Installing setuptools==71 first, then installing the package doesn't work as the default build isolation resolves the dependencies without considering the lock file nor currently installed packages.
Based on these packages need to be patched with setup_requires
before install, which is nearly impossible since we'd need to patch all packages.
Expected behavior
Install is successful.
How to Reproduce
- Create a virtual environment
- Upgrade to latest pip 24.2:
python -m pip install --upgrade pip
pip3.9 install doubles==1.4.0
Output
me@my ~/repro-pip-fail
% pip3.9 install doubles==1.4.0
Looking in indexes: http://…
Collecting doubles==1.4.0
Using cached http://…/doubles-1.4.0.tar.gz (16 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
Traceback (most recent call last):
File "/home/user/repro-pip-fail/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/user/repro-pip-fail/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/user/repro-pip-fail/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-h9ppcze_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/pip-build-env-h9ppcze_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-h9ppcze_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-h9ppcze_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'setuptools.command.test'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.