setuptools_scm: TypeError: setuptools_scm.config.Configuration() got multiple values for keyword argument 'relative_to'

My project build recently stopped working, failing with:

TypeError: setuptools_scm.config.Configuration() got multiple values for keyword argument ‘relative_to’

My setup.py looks like so:

import setuptools
setuptools.setup()

…and my pyproject.toml thusly:

[build-system]
requires = [
    "setuptools>=42",
    "wheel",
    "setuptools_scm>=6.2"
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
relative_to = "__file__"
fallback_version = "0.0.0"

If I comment out the relative_to configuration line in pyproject.toml, the build completes.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for the quick response @FlorianWilhelm ! Yes, removing the use_scm_version = {"relative_to": __file__} worked! 🎉 🙏

In conclusion, the fix was simply removing relative_to = "__file__" from my pyproject.toml.

Yes, I will release a version that takes the value out of the config and warns the user

Hi @RonnyPfannschmidt, thanks I guess an error message with a better warning would help.

Regarding the source of this error, we never had relative_to = "__file__" in pyproject.toml to the best of my knowledge, right @abravalheri? In our FAQ, we only say that in Monorepos it might make sense to have relative_to = "setup.py" in pyproject.toml, which should work, right? The actual problem is that __file__ is not resolved within pyproject.toml.