{"id":"e53ec9e9c7836b89","repo":"pypa/pip","slug":"missing-pyproject-build-system-requires","errorCode":"missing-pyproject-build-system-requires","errorMessage":"Can not process {package}","messagePattern":"Can not process (.+?)","errorType":"exception","errorClass":"MissingPyProjectBuildRequires","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/pyproject.py","lineNumber":85,"sourceCode":"        build_system = None\n\n    if build_system is None:\n        # In the absence of any explicit backend specification, we\n        # assume the setuptools backend that most closely emulates the\n        # traditional direct setup.py execution, and require wheel and\n        # a version of setuptools that supports that backend.\n\n        build_system = {\n            \"requires\": [\"setuptools>=40.8.0\"],\n            \"build-backend\": \"setuptools.build_meta:__legacy__\",\n        }\n\n    # Ensure that the build-system section in pyproject.toml conforms\n    # to PEP 518.\n\n    # Specifying the build-system table but not the requires key is invalid\n    if \"requires\" not in build_system:\n        raise MissingPyProjectBuildRequires(package=req_name)\n\n    # Error out if requires is not a list of strings\n    requires = build_system[\"requires\"]\n    if not _is_list_of_str(requires):\n        raise InvalidPyProjectBuildRequires(\n            package=req_name,\n            reason=\"It is not a list of strings.\",\n        )\n\n    # Each requirement must be valid as per PEP 508\n    for requirement in requires:\n        try:\n            get_requirement(requirement)\n        except InvalidRequirement as error:\n            raise InvalidPyProjectBuildRequires(\n                package=req_name,\n                reason=f\"It contains an invalid requirement: {requirement!r}\",\n            ) from error","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/pyproject.py#L67-L103","documentation":"Raised as MissingPyProjectBuildRequires when a pyproject.toml contains a [build-system] table but that table has no `requires` key. PEP 518 mandates that [build-system].requires be present and list the build dependencies. pip refuses to proceed because it cannot construct the isolated build environment without knowing which build tools to install.","triggerScenarios":"A pyproject.toml that declares `[build-system]` with only `build-backend` (or `backend-path`) but omits `requires`. The code path is pyproject.py:84 checking `if 'requires' not in build_system`. Also happens when the table is present but `requires` is set to null or accidentally renamed.","commonSituations":"Hand-writing a pyproject.toml and forgetting the requires line. Copy-pasting a partial template from a blog post. Migrating from setup.py-only to pyproject.toml and adding [build-system] prematurely. Tooling that autogenerates an incomplete build-system table.","solutions":["Open pyproject.toml and add a requires list under [build-system], e.g. `requires = [\"setuptools>=61.0\"]`.","If you use setuptools, also set `build-backend = \"setuptools.build_meta\"` alongside the requires.","If you did not mean to declare a custom build backend, remove the entire [build-system] table so pip falls back to the legacy setuptools default (pyproject.py:75).","Validate the file with a TOML linter or `python -c \"import tomllib; print(tomllib.loads(open('pyproject.toml','rb').read().decode()))\"`."],"exampleFix":"# before\n[build-system]\nbuild-backend = \"setuptools.build_meta\"\n# after\n[build-system]\nrequires = [\"setuptools>=61.0\"]\nbuild-backend = \"setuptools.build_meta\"","handlingStrategy":"validation","validationCode":"import tomllib\n\ndef validate_build_system_requires(path: str = \"pyproject.toml\") -> None:\n    with open(path, \"rb\") as f:\n        data = tomllib.load(f)\n    bs = data.get(\"build-system\")\n    if bs is not None and \"requires\" not in bs:\n        raise ValueError(\"[build-system] is missing the 'requires' key\")\n\nvalidate_build_system_requires()","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Start pyproject.toml from a known-good template that includes [build-system].requires.","Add a pre-commit hook that loads pyproject.toml and asserts build-system.requires exists.","If you don't need a custom backend, omit [build-system] entirely to use the setuptools default."],"tags":["pyproject","build-system","pep518","packaging"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}