pip: Could not find setuptools>=40.8.0 (with Setuptools installed)

Description

In https://github.com/jaraco/pip-run/issues/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 (https://github.com/jaraco/pip-run/commit/d6783eadb1fb3713793998763201b4c32d766c21), 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:

  • It’s the implicit “wheel” that’s missing (adding wheel works around the issue; https://github.com/jaraco/pip-run/pull/74), but there’s no mention of wheel.
  • The error indicates that it’s not a problem with pip because it’s a subprocess, but the error message comes directly from pip.

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

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@dreirund @tilktilk5 I was able to solve the issue by going into the stable-diffusion-webui directory and running following commands:

source venv/bin/activate
pip install lit
deactivate
./webui.sh

In my case, the lit package requires setuptools which looks like is not in the index https://download.pytorch.org/whl/rocm5.4.2 so by installing it manually without the --index-url parameter, it was able to get setuptools and thus when you try again, it would already be installed.

Maybe you were meant to use --extra-index-url rather than --index-url?

FYI, users should be aware --extra-index-url is inherently insecure for anything other than mirrors of the index url, it is therefore not part of the PyTorch instructions.

Likely the user is using a Python version not supported by PyTorch for that specific local build type, as you say they should check with PyTorch what is supported (installation instructions, help community, etc.).

When running ~/stable-diffusion-webui/venv/bin/pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 I am encountering the same error with the addition of Looking in indexes: https://download.pytorch.org/whl/cu118 before ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)

In addition, running ./venv/bin/pip install setuptools wheel returns Requirement already satisfied: setuptools in ./venv/lib/python3.11/site-packages (65.5.0) Requirement already satisfied: wheel in ./venv/lib/python3.11/site-packages (0.40.0)

Arch, pip 23.1.2, and python 3.11.3.

@tilktilk5 pleas provide the full error, you’ve left out the important information to which package is causing this error.

I do this on @tilktilk5’s behalf, since I have the same issue:

/opt/stable-diffusion-web-ui/venv/bin/python3 -m pip install torch==2.0.1+rocm5.4.2 torchvision==0.15.2+rocm5.4.2 --index-url https://download.pytorch.org/whl/rocm5.4.2:

Looking in indexes: https://download.pytorch.org/whl/rocm5.4.2
Collecting torch==2.0.1+rocm5.4.2
  Using cached https://download.pytorch.org/whl/rocm5.4.2/torch-2.0.1%2Brocm5.4.2-cp311-cp311-linux_x86_64.whl (1536.4 MB)
Collecting torchvision==0.15.2+rocm5.4.2
  Using cached https://download.pytorch.org/whl/rocm5.4.2/torchvision-0.15.2%2Brocm5.4.2-cp311-cp311-linux_x86_64.whl (62.4 MB)
Collecting filelock (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting typing-extensions (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/typing_extensions-4.8.0-py3-none-any.whl (31 kB)
Collecting sympy (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/sympy-1.12-py3-none-any.whl (5.7 MB)
Collecting networkx (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
Collecting jinja2 (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting pytorch-triton-rocm<2.1,>=2.0.0 (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/pytorch_triton_rocm-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78.4 MB)
Collecting numpy (from torchvision==0.15.2+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/numpy-1.26.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
Collecting requests (from torchvision==0.15.2+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/requests-2.28.1-py3-none-any.whl (62 kB)
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision==0.15.2+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/pillow-10.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB)
Collecting cmake (from pytorch-triton-rocm<2.1,>=2.0.0->torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/cmake-3.25.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.7 MB)
Collecting lit (from pytorch-triton-rocm<2.1,>=2.0.0->torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/lit-15.0.7.tar.gz (132 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      Looking in indexes: https://download.pytorch.org/whl/rocm5.4.2
      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.

I am not familiar with Python’s own packaging; I use Arch Linux packages whenever possible.

I have the Arch Linux package python-setuptools, version 1:69.0.3-1 (setuptools 69.0.3) installed system-wide.

Regards!

pip should contain everything it needs to install a local package and the current behavior is a regression.

No, it is not.

pip install for dependency free packages without requiring any additional files.

You can still do that, as long as you have a built distribution file (i.e. a .whl file). See https://pradyunsg.me/blog/2022/12/31/wheels-are-faster-pure-python/.