pypa/pip · error · InstallationError
[dependency-groups] resolution failed for '{groupname}' from
Error message
[dependency-groups] resolution failed for '{groupname}' from '{path}': {'; '.join(messages)} What it means
Raised by _resolve_all_groups() when DependencyGroupResolver.resolve(groupname) raises an ExceptionGroup while resolving a specific `[dependency-groups]` entry (req_dependency_group.py:32-38). All sub-exception messages are joined into a single InstallationError. This means the group was found but one or more requirement specifiers inside it are invalid or reference other groups incorrectly.
Source
Thrown at src/pip/_internal/req/req_dependency_group.py:35
resolvers = _build_resolvers(path for (path, _) in groups)
return list(_resolve_all_groups(resolvers, groups))
def _resolve_all_groups(
resolvers: dict[str, DependencyGroupResolver], groups: list[tuple[str, str]]
) -> Iterator[str]:
"""
Run all resolution, converting any error from `DependencyGroupResolver` into
an InstallationError.
"""
for path, groupname in groups:
resolver = resolvers[path]
try:
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"]View on GitHub (pinned to d7d0d0a394)
Solutions
- Read the joined messages in the error — each names a specific malformed entry; fix each one.
- Ensure every requirement string in the group is valid PEP 508 (test with packaging.requirements.Requirement).
- For group-to-group references using `{other}`, confirm the referenced group exists and is not circular.
- Re-run `pip install --group mygroup` after corrections.
Example fix
# before [dependency-groups] mygroup = ["requests", "bad =spec"] # after [dependency-groups] mygroup = ["requests", "otherpkg>=1.0"]
Defensive patterns
Strategy: validation
Validate before calling
import tomllib
from pip._vendor.packaging.dependency_groups import DependencyGroupResolver
from pip._vendor.packaging.errors import ExceptionGroup
def validate_group_resolves(path: str, group: str) -> list[str]:
with open(path, "rb") as f:
data = tomllib.load(f)
raw = data.get("dependency-groups", {})
resolver = DependencyGroupResolver(raw)
try:
return [str(r) for r in resolver.resolve(group)]
except ExceptionGroup as eg:
raise ValueError("; ".join(str(e) for e in eg.exceptions)) from eg Type guard
null
Try / catch
from pip._internal.exceptions import InstallationError
try:
parse_dependency_groups([(path, group)])
except InstallationError as e:
if "resolution failed" in str(e):
# show the joined sub-error messages to the user
...
raise Prevention
- Validate every requirement string inside [dependency-groups] with packaging.requirements.Requirement in CI.
- Avoid circular or undefined `{group}` references.
- Test `pip install --group <name>` locally before pushing changes.
When it happens
Trigger: Using `pip install --group mygroup` where pyproject.toml's [dependency-groups] has a malformed entry, an invalid PEP 508 requirement, a circular group reference, or references a non-existent group. The resolver (from packaging.dependency_groups) bundles failures into an ExceptionGroup which pip flattens.
Common situations: Typos in requirement specifiers within a dependency group. Self-referential or mutually-referential groups. Referencing an undefined group via `{another-group}` syntax. Migrating requirements files into groups with transcription errors.
Related errors
- [dependency-groups] table was malformed in {path}. Cannot re
- [dependency-groups] data was invalid in {path}: {'; '.join(m
- [dependency-groups] table was missing from '{path}'. Cannot
- Error parsing {path}: {e}
- Multiple {name!r} blocks found in {scriptfile!r}
AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04).
Data as JSON: /data/errors/fd7d6b14e0d018cd.json.
Report an issue: GitHub.