pypa/pip · error · InstallationError
[dependency-groups] table was missing from
Error message
[dependency-groups] table was missing from '{path}'. Cannot resolve '--group' option. What it means
pip was asked to resolve a '--group' but the specified pyproject.toml does not contain a '[dependency-groups]' table at all. Without this table, there are no groups to resolve, so pip aborts early in _build_resolvers().
Solutions
- Add a [dependency-groups] table to your pyproject.toml with at least one group
- Verify you are pointing at the correct pyproject.toml if using a custom path
- Remove the --group flag if your project does not use dependency groups
Example fix
# before — pyproject.toml has no dependency-groups [project] name = "mypackage" # after [project] name = "mypackage" [dependency-groups] dev = ["pytest", "ruff"]
Defensive patterns
Strategy: validation
Validate before calling
from pip._internal.utils.compat import tomllib
def has_dependency_groups_table(path: str) -> bool:
with open(path, "rb") as fp:
data = tomllib.load(fp)
return "dependency-groups" in data
if not has_dependency_groups_table("pyproject.toml"):
print("No [dependency-groups] table — add one or remove --group") Type guard
from pip._internal.utils.compat import tomllib
def has_dependency_groups(path: str) -> bool:
"""Type guard: True if pyproject.toml has a [dependency-groups] table."""
with open(path, "rb") as fp:
return "dependency-groups" in tomllib.load(fp) Try / catch
from pip._internal.exceptions import InstallationError
from pip._internal.req.req_dependency_group import parse_dependency_groups
try:
reqs = parse_dependency_groups([("pyproject.toml", "dev")])
except InstallationError as e:
if "table was missing" in str(e):
print("Add a [dependency-groups] table to pyproject.toml")
else:
raise Prevention
- Add a [dependency-groups] table before using --group
- Validate pyproject.toml has the table in CI before invoking pip --group
- Remove the --group flag if your project does not use dependency groups
When it happens
Trigger: Running 'pip install --group dev' in a project whose pyproject.toml has no [dependency-groups] section. The check 'if dependency-groups not in pyproject' fails.
Common situations: Project has not adopted PEP 735 dependency groups yet. Wrong pyproject.toml path was specified. The table was accidentally removed or renamed during editing.
Related errors
- [dependency-groups] data was invalid in
- [dependency-groups] resolution failed for
- [dependency-groups] table was malformed in
- not found. Cannot resolve '--group' option.
- Error parsing
AI-assisted analysis of pypa/pip@f399c37189 (2026-08-08).
Data as JSON: /api/errors/2a20bd7614aee708.
Report an issue: GitHub.
Appendix: source
Thrown at src/pip/_internal/req/req_dependency_group.py:49
yield from (str(req) for req in resolver.resolve(groupname))
except ExceptionGroup as eg:
# Convert ExceptionGroup to a single InstallationError with all messages
messages = [str(e) for e in eg.exceptions]
raise InstallationError(
f"[dependency-groups] resolution failed for '{groupname}' "
f"from '{path}': {'; '.join(messages)}"
) from eg
def _build_resolvers(paths: Iterable[str]) -> dict[str, Any]:
resolvers = {}
for path in paths:
if path in resolvers:
continue
pyproject = _load_pyproject(path)
if "dependency-groups" not in pyproject:
raise InstallationError(
f"[dependency-groups] table was missing from '{path}'. "
"Cannot resolve '--group' option."
)
raw_dependency_groups = pyproject["dependency-groups"]
if not isinstance(raw_dependency_groups, dict):
raise InstallationError(
f"[dependency-groups] table was malformed in {path}. "
"Cannot resolve '--group' option."
)
try:
resolvers[path] = DependencyGroupResolver(raw_dependency_groups)
except ExceptionGroup as eg:
# Handle ExceptionGroup from resolver initialization
messages = [str(e) for e in eg.exceptions]
raise InstallationError(
f"[dependency-groups] data was invalid in {path}: {'; '.join(messages)}"
) from egView on GitHub (pinned to f399c37189)