Skip to content

Could not find setuptools>=40.8.0 (with Setuptools installed) #12050

@jaraco

Description

@jaraco

Description

In jaraco/pip-run#73, I was investigating an issue surfaced by the removal of setuptools/wheel by default from virtualenv on Python 3.12. While troubleshooting, I added Setuptools as a dependency (jaraco/pip-run@d6783ea), but the error persisted:

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
      ERROR: No matching distribution found for setuptools>=40.8.0
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

The test that's failing is simply building a legacy Setuptools project (setup.py, no pyproject.toml). It's failing to find Setuptools presumably because the tests are passing --no-index.

This error is confusing in a couple of ways:

Expected behavior

Ideally, pip shouldn't try to install setuptools if it's installed and satisfied. If it needs wheel and/or setuptools to do the build but it doesn't have one, it should state as much ("installing implied {setuptools or wheel} for legacy build"), and then only attempt to install the missing package.

Separately, it's apparent that the subprocess boundary isn't a good indicator of which project might be responsible. Better would be for pip to indicate which builder was used and maybe which project might be responsible (maybe).

pip version

23.3.1

Python version

3.12.0a7

OS

any

How to Reproduce

With setuptools/wheel uninstalled:

 $ cat > setup.py
import setuptools; setuptools.setup()
 $ pip-run setuptools -- -m pip install --no-index .
Processing /Users/jaraco/draft
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
      ERROR: No matching distribution found for setuptools>=40.8.0
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies 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.

Note the build succeeds if wheel is present:

 $ pip-run setuptools wheel -- -m pip-run -v --no-index . -- -c pass
Processing /Users/jaraco/draft
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (setup.py) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=920 sha256=675c0cd23b1d6de46af0e8377682867186cedb68b275787323ea61584caaed0a
  Stored in directory: /private/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-ephem-wheel-cache-yv5_0l1v/wheels/85/87/4e/90d5ac6e5f68ec20eda74f6d3622a8e87f2c519c5b71ef64a8
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
Successfully installed UNKNOWN-0.0.0

Output

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    S: needs triageIssues/PRs that need to be triagedtype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions