Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Many packages are no longer installable after test command is removed #4519

Closed
chrisirhc opened this issue Jul 29, 2024 · 127 comments · Fixed by #4522
Closed

[BUG] Many packages are no longer installable after test command is removed #4519

chrisirhc opened this issue Jul 29, 2024 · 127 comments · Fixed by #4522

Comments

@chrisirhc
Copy link

chrisirhc commented Jul 29, 2024

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 with setuptools<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

  1. Create a virtual environment
  2. Upgrade to latest pip 24.2: python -m pip install --upgrade pip
  3. 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.
@chrisirhc chrisirhc added bug Needs Triage Issues that need to be evaluated for severity and status. labels Jul 29, 2024
@databius
Copy link

databius commented Jul 29, 2024

I got a similar error today.

@snjtkh
Copy link

snjtkh commented Jul 29, 2024

we are also getting similar error.

@nibe12
Copy link

nibe12 commented Jul 29, 2024

i got a similiar error too

@vinothsubramanian
Copy link

I am also blocked because of this error

IBM/python-sdk-core#202

@smiledelf
Copy link

after an hour of googling, looks like I found the right bug :)
this is an issue when installing dbt-core==1.8.4, which lists Logbook==1.5.3 as a requirement.

Latest Logbook (1.7.0) seems to have fixed this but dbt-core still points to the older broken module.

@hashken
Copy link

hashken commented Jul 29, 2024

Facing same error here.

09:04:19    ERROR: Command errored out with exit status 1:
09:04:19     command: /var/lib/****/.pex/venvs/s/301ee4ad/venv/bin/python3.9 /var/lib/****/.pex/venvs/s/301ee4ad/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpato8w6eb
09:04:19         cwd: /tmp/pip-download-xmdfaim1/sqlalchemy
09:04:19    Complete output (19 lines):
09:04:19    /tmp/pip-build-env-kra8zma_/overlay/lib/python3.9/site-packages/_distutils_hack/__init__.py:55: UserWarning: Reliance on distutils from stdlib is deprecated. Users must rely on setuptools to provide the distutils module. Avoid importing distutils or import setuptools first, and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. Register concerns at https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml
09:04:19      warnings.warn(
09:04:19    Traceback (most recent call last):
09:04:19      File "/var/lib/****/.pex/venvs/s/301ee4ad/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
09:04:19        main()
09:04:19      File "/var/lib/****/.pex/venvs/s/301ee4ad/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
09:04:19        json_out['return_val'] = hook(**hook_input['kwargs'])
09:04:19      File "/var/lib/****/.pex/venvs/s/301ee4ad/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
09:04:19        return hook(config_settings)
09:04:19      File "/tmp/pip-build-env-kra8zma_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
09:04:19        return self._get_build_requires(config_settings, requirements=[])
09:04:19      File "/tmp/pip-build-env-kra8zma_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
09:04:19        self.run_setup()
09:04:19      File "/tmp/pip-build-env-kra8zma_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 497, in run_setup
09:04:19        super().run_setup(setup_script=setup_script)
09:04:19      File "/tmp/pip-build-env-kra8zma_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
09:04:19        exec(code, locals())
09:04:19      File "<string>", line 14, in <module>
09:04:19    ModuleNotFoundError: No module named 'setuptools.command.test'

@popunbom
Copy link

I was also faced this issue with cssbeautifier library, and solved by installing with --no-build-isolation
option in my case.

❯ docker run --rm -it 'python:3.9' /bin/bash

root@81f338564edc:/# python -m pip install --upgrade pip
Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (23.0.1)
Collecting pip
  Downloading pip-24.2-py3-none-any.whl (1.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 5.0 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.0.1
    Uninstalling pip-23.0.1:
      Successfully uninstalled pip-23.0.1
Successfully installed pip-24.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

root@81f338564edc:/# pip3.9 install cssbeautifier
Collecting cssbeautifier
  Downloading cssbeautifier-1.15.1.tar.gz (25 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 "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/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 "/usr/local/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-sd2vprw8/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-sd2vprw8/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-sd2vprw8/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-sd2vprw8/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 9, 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.

root@81f338564edc:/# pip3.9 install --no-build-isolation cssbeautifier
Collecting cssbeautifier
  Using cached cssbeautifier-1.15.1.tar.gz (25 kB)
  Preparing metadata (pyproject.toml) ... done
Collecting jsbeautifier (from cssbeautifier)
  Downloading jsbeautifier-1.15.1.tar.gz (75 kB)
  Preparing metadata (pyproject.toml) ... done
Collecting six>=1.13.0 (from cssbeautifier)
  Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting editorconfig>=0.12.2 (from cssbeautifier)
  Downloading EditorConfig-0.12.4.tar.gz (13 kB)
  Preparing metadata (pyproject.toml) ... done
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: cssbeautifier, editorconfig, jsbeautifier
  Building wheel for cssbeautifier (pyproject.toml) ... done
  Created wheel for cssbeautifier: filename=cssbeautifier-1.15.1-py3-none-any.whl size=30536 sha256=fe16be1043cad7c149be1d60d9320b61f2c64ba672681fab279b2a88a71d9ff4
  Stored in directory: /root/.cache/pip/wheels/7f/2d/19/5d9d82d3c7280e2c68a07b906c458f0a5506cb2b812d330383
  Building wheel for editorconfig (pyproject.toml) ... done
  Created wheel for editorconfig: filename=EditorConfig-0.12.4-py3-none-any.whl size=16377 sha256=9acd52f9cb94f6fabd33cc641d4acb07a4714ada4678388b08e45722eabd5607
  Stored in directory: /root/.cache/pip/wheels/0b/7b/d7/1979a68ec6ce660c89044dc57d175e32f1943bcb8937e43f6e
  Building wheel for jsbeautifier (pyproject.toml) ... done
  Created wheel for jsbeautifier: filename=jsbeautifier-1.15.1-py3-none-any.whl size=94721 sha256=c9fefe5c1d947c492e3b8ea0173783df9821f8ca8a46637a8d4a645b9070ae18
  Stored in directory: /root/.cache/pip/wheels/1f/82/d9/63c09b95f4576d2822b61d073de8f4e3b6fd386112dcb9835d
Successfully built cssbeautifier editorconfig jsbeautifier
Installing collected packages: editorconfig, six, jsbeautifier, cssbeautifier
Successfully installed cssbeautifier-1.15.1 editorconfig-0.12.4 jsbeautifier-1.15.1 six-1.16.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

@hauntsaninja
Copy link
Contributor

hauntsaninja commented Jul 29, 2024

Here's how to work around this breakage:

Option 1:
Create a file called constraints.txt

setuptools<72

Then set PIP_CONSTRAINT=/path/to/constraints.txt

Option 2: Use --no-build-isolation (and make sure you have an old setuptools installed)

Option 3: Ask the maintainers of each package that is broken like this to adapt to new setuptools and wait for them to make a release

In general, I find it unfortunate that build isolation intends to increase reproducibility, but the tools given to users make this really tricky in practice. I think ^ is pretty hard for most Python users I know to come up with (and lacks e.g. the ability to hash pin). Probably wrong place to rant though, setuptools maintainers probably feel the pain of this more than anyone else! :-)

Edit: if setuptools does decide to revert something here, I have a suggestion in #4520 for how the underlying change could be rolled out more gradually

@Hannes0730
Copy link

Hannes0730 commented Jul 29, 2024

Here's how to workaround this breakage:

Option 1: Create a file called constraints.txt

setuptools<72

Then set PIP_CONSTRAINT=/path/to/constraints.txt (or UV_CONSTRAINT if using uv)

Option 2: Use --no-build-isolation (and make sure you have an old setuptools installed)

Option 3: Ask the maintainers of each package that is broken like this to adapt to new setuptools and wait for them to make a release

In general, I find it unfortunate that build isolation intends to increase reproducibility, but in practice the tools given to users make this really tricky in practice. I think ^ is pretty hard for most Python users I know to come up with. Probably wrong place to rant though, setuptools maintainers probably feel the pain of this more than anyone else! :-)

Hi, is option 1 compatible with poetry add <package-name>? or is that pip dependent? I tried option 2 but I think --no-build-isolation is not supported in poetry (1.8.2).

RUN poetry install --no-interaction --no-build-isolation --without dev --no-ansi -vvv

I am currently running this on Dockerfile

@bebound
Copy link
Contributor

bebound commented Jul 29, 2024

This is the related PR: #4458

@anyidea
Copy link

anyidea commented Jul 29, 2024

Same issue.

@Luke31
Copy link

Luke31 commented Jul 29, 2024

Would it be possible to mark this version as yanked in pypi and follow a more gradual approach with deprecation warnings on install as mentioned in #4520 ?

Especially installs with poetry seem to have issues and currently I couldn't find a solution to overcome it. Did anybody find a solution for following or similar combination?

  • docker
  • poetry==1.7.1
  • python:3.10
  • some package not supporting PEP 517 (in our case sqlalchemy==1.4.49 )

EDIT: Found a solution thanks to help of @ilpianista and @Hannes0730 , see my post below: #4519 (comment)

(Of course we want to upgrade, but we're still using sqlalchemy==1.4.49 which requires a major upgrade to 2.0 to support PEP 517).

RazvanLiviuVarzaru pushed a commit to MariaDB/buildbot that referenced this issue Jul 30, 2024
pna-nca added a commit to netceteragroup/django-DefectDojo that referenced this issue Jul 30, 2024
szokeasaurusrex added a commit to getsentry/sentry-python that referenced this issue Jul 30, 2024
Revert #3371, which was needed to work around pypa/setuptools#4519 and allow our Django tests to run on Python 3.12. pypa/setuptools#4519 has been resolved upstream, so the workaround should no longer be needed.
guyer added a commit to usnistgov/fipy that referenced this issue Jul 30, 2024
guyer added a commit to usnistgov/fipy that referenced this issue Jul 30, 2024
* Remove constraint on scotch

conda-forge/petsc-feedstock#181 fixed things?

* Constrain petsc(4py) < 3.20.3

Avoids failures in:
- fipy/terms/abstractConvectionTerm.py
- examples/diffusion/nthOrder/input4thOrder1D.py
and crashes in:
- examples/phase/binaryCoupled.py
- examples/diffusion/nthOrder/input4thOrder_line.py

See #1054 

* Constrain version of setuptools

setuptools 72.x breaks `test` and `test_suite`.
[72.1.0](https://setuptools.pypa.io/en/stable/history.html#v72-1-0)
restores `test`, but `test_suite`still doesn't work right.

https://setuptools.pypa.io/en/stable/history.html#v72-0-0
pypa/setuptools#4519
https://stackoverflow.com/questions/78806100/no-module-named-setuptools-command-test

See #805 

* Update petsc lockfiles
zahlman added a commit to zahlman/RandomWords that referenced this issue Jul 31, 2024
In Setuptools 72.0.0, `setuptools.command.test` was temporarily removed.
This version of Setuptools was yanked, and 72.1.0 restored the
functionality (it appears that the removal didn't follow the standard
process, but this functionality has been deprecated for many years).

The functionality will be removed in a future version (probably very
soon) and that would break this `setup.py` as a result.

This commit, as a first step, handles the `ImportError` that results
when `setuptools.command.test` is removed, and only attempts to define
the `PyTest` command (the only thing depending on it) when it's
available.

For more details, please see:

pypa/setuptools#4519

Although many projects were affected by the change, this one was the
unlucky "winner" of a popular Stack Overflow Q&A drawing attention to
the general issue:

https://stackoverflow.com/questions/78806100
elprans added a commit to edgedb/edgedb-python that referenced this issue Aug 3, 2024
elprans added a commit to edgedb/edgedb-python that referenced this issue Aug 5, 2024
OjusWiZard pushed a commit to OjusWiZard/rotki that referenced this issue Aug 9, 2024
As documented here pypa/setuptools#4519 setuptools has released
a breaking change that removes a functionality used by some our dependencies breaking
the install process. In our case is the VCR package that has been already notified kevin1024/vcrpy#858

[run nft py tests]
pna-nca added a commit to netceteragroup/django-DefectDojo that referenced this issue Aug 23, 2024
pna-nca added a commit to netceteragroup/django-DefectDojo that referenced this issue Aug 23, 2024
pna-nca added a commit to netceteragroup/django-DefectDojo that referenced this issue Aug 23, 2024
pna-nca added a commit to netceteragroup/django-DefectDojo that referenced this issue Aug 23, 2024
pna-nca added a commit to netceteragroup/django-DefectDojo that referenced this issue Aug 23, 2024
pna-nca added a commit to netceteragroup/django-DefectDojo that referenced this issue Aug 25, 2024
benbz added a commit to matrix-org/synapse-s3-storage-provider that referenced this issue Sep 3, 2024
anoadragon453 pushed a commit to matrix-org/synapse-s3-storage-provider that referenced this issue Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.