setuptools rejects pyproject.toml because the [project] table has no name
Fix it fast
Most common cause, 1 of 3A partial [project] table sits beside a setup.py that still sets the name
Make [project] complete: put name and version in it, and move the other metadata over from setup.py.
[build-system]
requires = ["setuptools >= 77.0.3"]
build-backend = "setuptools.build_meta"
[project]
name = "my-package"
version = "1.4.0"
requires-python = ">=3.10"
dependencies = ["requests"]Short answer
setuptools 61 and later treat any [project] table in pyproject.toml as standard metadata, where name is mandatory and may not be dynamic. The error means that table exists without name, usually because name still lives in setup.py or [tool.poetry]. Add name and version to [project], delete the partial table, or declare the right backend. Applies to setuptools 61 to 84.
Which cause do you have?
Find out whose pyproject.toml failed. If pip was processing a downloaded .tar.gz just before the error, the file belongs to a dependency (cause 3). If it was your own folder, print the table headers and any name lines to see where the name is kept.
pip install . 2>&1 | grep -E "Processing|Downloading|must contain"
grep -nE '^\[|^ *name *=' pyproject.toml
ls setup.py setup.cfg 2>/dev/nullThen find the line you see in this list and open its fix:
- 1A partial [project] table sits beside a setup.py that still sets the name
setup.py or setup.cfg passes name, while [project] in pyproject.toml carries only a field or two such as requires-python or dependencies - 2Poetry keeps the name in [tool.poetry], but pip hands the build to setuptools
pyproject.toml has [tool.poetry] with name and version, and there is no [build-system] table (or it names setuptools) - 3An old release of a dependency ships the broken file and pip builds it from source
The lines before the error show pip processing another package's .tar.gz inside a pip-build-env folder, not your project
What does the error look like?
configuration error: `project` must contain ['name'] propertiesValueError: invalid pyproject.toml config: `project`.× Preparing metadata (pyproject.toml) did not run successfully.error: metadata-generation-failed
Cause 1 of 3
A partial [project] table sits beside a setup.py that still sets the name
You seesetup.py or setup.cfg passes name, while [project] in pyproject.toml carries only a field or two such as requires-python or dependencies
Check
The message `project` must contain ['name'] properties appears because setuptools found a [project] table and switched to PEP 621 rules, which require name inside that table. A name given in setup.py does not count. Projects often get such a stub when a tool like cibuildwheel or Dependabot reads requires-python from it.
grep -n "name=" setup.py
sed -n '/^\[project\]/,/^\[/p' pyproject.tomlFix
Make [project] complete: put name and version in it, and move the other metadata over from setup.py. Since setuptools 69, a field still set in setup.py is only accepted when [project] lists it under dynamic. If you never meant setuptools to use [project], delete that table instead; setuptools then reads setup.py and setup.cfg as before.
[build-system]
requires = ["setuptools >= 77.0.3"]
build-backend = "setuptools.build_meta"
[project]
name = "my-package"
version = "1.4.0"
requires-python = ">=3.10"
dependencies = ["requests"]Verify
The build runs to the end and a wheel for your project lands in dist/.
pip wheel . --no-deps -w dist && ls distConfirmed by github.com
Cause 2 of 3
Poetry keeps the name in [tool.poetry], but pip hands the build to setuptools
You seepyproject.toml has [tool.poetry] with name and version, and there is no [build-system] table (or it names setuptools)
Check
With no [build-system] table, pip falls back to setuptools and its __legacy__ backend. setuptools knows nothing about [tool.poetry], so a [project] table holding only dependencies or requires-python looks nameless to it. Poetry before 2.0 stored all metadata under [tool.poetry].
sed -n '/^\[build-system\]/,/^\[/p' pyproject.tomlFix
Declare Poetry as the build backend. Poetry accepts name and version from either [project] or [tool.poetry], so the build then succeeds without moving fields.
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"Verify
pip builds the project through poetry-core and the traceback no longer passes through setuptools/config/pyprojecttoml.py.
pip wheel . --no-deps -w distConfirmed by pip.pypa.io
Cause 3 of 3
An old release of a dependency ships the broken file and pip builds it from source
You seeThe lines before the error show pip processing another package's .tar.gz inside a pip-build-env folder, not your project
Check
pip falls back to a source build when it finds no wheel for your Python version or platform. Some older releases ship a [project] table that leaves name out, often holding nothing but requires-python, and current setuptools refuses it during Preparing metadata. The setuptools tracker records this with old pikepdf and asyncpg releases.
pip install --dry-run --only-binary :all: <package>==<version>Fix
Move the dependency to a newer release that publishes a wheel for your Python, and tell pip not to build that package from source so a missing wheel fails at once.
pip install --only-binary <package> "<package>>=<newer-version>"Verify
pip downloads a .whl file for the dependency and no Preparing metadata step runs for it.
pip install --only-binary <package> "<package>>=<newer-version>" 2>&1 | grep -E "\.whl|\.tar\.gz"Confirmed by github.com
How do I stop it coming back?
- Keep each project's metadata in one place: a full [project] table, or setup.py and setup.cfg, never half in each.
- Run pip wheel . --no-deps in CI on every pull request so a pyproject.toml edit that breaks metadata fails before release.
- Always write a [build-system] table naming your backend, as the PyPA guide recommends, so pip never guesses setuptools.
- In requirements files, pin dependencies to versions that ship wheels for the Python you deploy on.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: stegnor.com, Menulo, ShopGo.