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
- I agree to follow the PSF Code of Conduct.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 15 (8 by maintainers)
@dreirund @tilktilk5 I was able to solve the issue by going into the stable-diffusion-webui directory and running following commands:
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.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 ofLooking in indexes: https://download.pytorch.org/whl/cu118
beforeERROR: 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
returnsRequirement 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.
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
: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!
No, it is not.
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/.