uv: `setuptools` fails with "Invalid dash-separated key" or "Invalid uppercase key"

setuptools v78 no longer accepts options containing uppercase or dash characters in setup.cfg. This means if your package uses this feature, or if any of your dependencies need to be built from source (and are using the invalid syntax) then an error will be raised.

This can be worked around in the uv CLI by excluding new versions:

$ uv sync --exclude-newer 2025-03-24

This fix can be persisted in the pyproject.toml as:

[tool.uv]
exclude-newer = "2025-03-24T00:00:00Z"

Note this will prevent upgrading other packages.

If you are using uv pip, you can set a build constraint instead:

echo "setuptools<78" | uv pip install -b - <package>

This fix can be persisted in the pyproject.toml as:

[tool.uv]
build-constraint-dependencies = ["setuptools<78"]

There is an unrelated uv bug that does not propagate build-constraint-dependencies in uv sync (https://github.com/astral-sh/uv/issues/12441). We will be releasing a fix for that soon.

I’ve asked for the change to be reverted upstream at https://github.com/pypa/setuptools/pull/4870#issuecomment-2748731521

We’re also adding a dedicated warning for this error case in https://github.com/astral-sh/uv/pull/12438

See also

About this issue

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

Commits related to this issue

Most upvoted comments

Unfortunately exclude-newer will refuse to install packages that have no upload date specified, which of course, happens to include popular public packages 🤦

warning: pytest_django-4.10.0.tar.gz is missing an upload date, but user provided: 2025-03-24T20:00:00Z
warning: responses-0.17.0.tar.gz is missing an upload date, but user provided: 2025-03-24T20:00:00Z

Anyway, it would be better if uv used the same setuptools in the env when installed

It has been a Python packaging standard to seperate out build dependencies from runtime dependencies for years now, generally it has solved a lot more problems than it has created, all modern packaging tools I am aware of support it.

It was defined in https://peps.python.org/pep-0517/ and discussion about problems it has and solutions to those problems should be discussed over at https://discuss.python.org/c/packaging/14

Hi everyone, 20 minutes ago setuptools added a new package that postpones this change:

https://setuptools.pypa.io/en/stable/history.html

Anyway, it would be better if uv used the same setuptools in the env when installed

Also hitting the limitation with exclude-newer. It would be great to have a flag to ignore this constraint for packages that don’t publish version data.

Unfortunately exclude-newer will refuse to install packages that have no upload date specified, which of course, happens to include popular public packages 🤦

warning: pytest_django-4.10.0.tar.gz is missing an upload date, but user provided: 2025-03-24T20:00:00Z
warning: responses-0.17.0.tar.gz is missing an upload date, but user provided: 2025-03-24T20:00:00Z

Yes, getting the same one for torch==2.3.0

warning: torch-2.3.0+cu118-cp310-cp310-linux_x86_64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp310-cp310-win_amd64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp311-cp311-linux_x86_64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp311-cp311-win_amd64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp312-cp312-linux_x86_64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp312-cp312-win_amd64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp38-cp38-linux_x86_64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp38-cp38-win_amd64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp39-cp39-linux_x86_64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
warning: torch-2.3.0+cu118-cp39-cp39-win_amd64.whl is missing an upload date, but user provided: 2025-03-24T00:00:00Z
  x No solution found when resolving dependencies:
  `-> Because there is no version of torch==2.3.0 ....