37

Recently, I faced this issue with Poetry. All my commands using poetry were failing with the following error.

RuntimeError

  The Poetry configuration is invalid:
    - Additional properties are not allowed ('group' was unexpected)
Roopak A Nelliat
  • 2,009
  • 3
  • 19
  • 26
  • Check that you use the correct poetry virtual environment. Just had the same issue and deleting the .venv directory and running poetry install again resolved the problem. – colin Nov 14 '22 at 08:54
  • poetry seems to break backwards compatibilty every other version, I would steer clear of it. – silverwind Feb 21 '23 at 23:40

2 Answers2

41

I figured out the following issue.

  1. The code owners had updated the poetry core requirement to requires = ["poetry-core>=1.2.0"]
  2. My current poetry version was 1.1.12

I did the following to fix my issue.

# remove the current poetry installation
rm -rf /Users/myusername/.poetry

# upgrade poetry version
pip install poetry -U

This should solve the problem. I verified the same by running my other poetry commands.

It should be noted that your current poetry configurations will be lost while doing this, and would need to be recreated and reinstalled.

# reinstall poetry for my project
poetry install
Roopak A Nelliat
  • 2,009
  • 3
  • 19
  • 26
10

This is because you're working on a repo that uses the new version of Poetry, >=1.2.0 and you may have the old poetry installed locally.

The new version of pyproject.toml file supports dependency groups such as the following example

[tool.poetry.group.new_group]
optional = true

[tool.poetry.group.new_group.dependencies]
tensorflow = "*"

The solution is to update your version of Poetry using the instructions in the poetry docs.

azizbro
  • 3,069
  • 4
  • 22
  • 36