pip: Pip 22.1 (only) fails when included in pyproject.toml

Description

Starting with pip 22.1, including “pip” in the pyproject.toml [build-system] requires fails.

Example pyproject.toml:

[build-system]
requires = [
    "setuptools>=40.8.0", 
    "wheel",
    "pip"
]
build-backend = "setuptools.build_meta"

Error:

(venv) D:\Dev\myPyPackage>python -m pip install D:\Dev\myPyPackage
Looking in indexes: https://pypi.org/simple
Processing d:\dev\mypypackage
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      Looking in indexes: https://pypi.org/simple
      Collecting setuptools>=40.8.0
        Using cached setuptools-62.2.0-py3-none-any.whl (1.1 MB)
      Collecting wheel
        Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
      Collecting pip
        Using cached pip-22.1-py3-none-any.whl (2.1 MB)
      ERROR: To modify pip, please run the following command:
      D:\Dev\myPyPackage\venv\Scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\cowlinator\AppData\Local\Temp\pip-build-env-upw4u049\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --trusted-host pypi.org -- setuptools>=40.8.0 wheel pip
      [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.

Verified that this succeeds with pip 22.0.4

This error message repeatedly states that this is likely not a problem with pip… but it is the change from pip 22.0.4 to 22.1 that breaks it.

Expected behavior

I expect pip 22.1 to behave the same as pip 22.0.4; namely, that the installation succeeds.

Output when using pip 22.0.4:

(venv) D:\Dev\myPyPackage>python -m pip install D:\Dev\myPyPackage
Looking in indexes: https://pypi.org/simple
Processing d:\dev\mypypackage
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: hi
  Building wheel for hi (pyproject.toml) ... done
  Created wheel for hi: filename=hi-0.0.0-py3-none-any.whl size=1048 sha256=b5e4d2b574164c3e8c93ea425bd63f58876eb58087dedd259755a9326ddc84fd
  Stored in directory: C:\Users\cowlinator\AppData\Local\Temp\pip-ephem-wheel-cache-u03_8ou9\wheels\6a\64\7b\c6556dc063c160509a71a3f427d795bea205706ceccf1319ff
Successfully built hi
Installing collected packages: hi
Successfully installed hi-0.0.0
WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
You should consider upgrading via the 'D:\Dev\myPyPackage\venv\Scripts\python.exe -m pip install --upgrade pip' command.

pip version

22.1

Python version

3.7.9

OS

Windows 11 (21H2)

How to Reproduce

  1. Create a virtual environment and activate it
  2. Install pip 22.1
  3. Create a python package with a pyproject.toml containing:
[build-system]
requires = [
    "setuptools>=40.8.0", 
    "wheel",
    "pip"
]
build-backend = "setuptools.build_meta"
  1. Install this python package from the local directory with python -m pip install <dir>
  2. Observe the error

Output

D:\Dev\myPyPackage>python -m venv venv && venv\Scripts\activate

(venv) D:\Dev\myPyPackage>python -m pip install --upgrade pip
Looking in indexes: https://pypi.org/simple
Collecting pip
  Using cached pip-22.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.1.1
    Uninstalling pip-20.1.1:
      Successfully uninstalled pip-20.1.1
Successfully installed pip-22.1

(venv) D:\Dev\myPyPackage>python -m pip install D:\Dev\myPyPackage
Looking in indexes: https://pypi.org/simple
Processing d:\dev\mypypackage
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [9 lines of output]
      Looking in indexes: https://pypi.org/simple
      Collecting setuptools>=40.8.0
        Using cached setuptools-62.2.0-py3-none-any.whl (1.1 MB)
      Collecting wheel
        Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
      Collecting pip
        Using cached pip-22.1-py3-none-any.whl (2.1 MB)
      ERROR: To modify pip, please run the following command:
      D:\Dev\myPyPackage\venv\Scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\cowlinator\AppData\Local\Temp\pip-build-env-upw4u049\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --trusted-host pypi.org -- setuptools>=40.8.0 wheel pip
      [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.

Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (15 by maintainers)

Most upvoted comments

AH, I see what’s happening now. Thanks for sharing this @grgmiller!

…I had no reason to think it didn’t need to be there? It needs setuptools and wheel to be there

Why does wheel need to be there? Setuptools lists it as a dependency for building wheels and is automatically installed when necessary.

sys.argv[0] is C:\Users\Greg\AppData\Local\Temp\pip-standalone-pip-r8sq_f5z\__env_pip__.zip\pip