pypa/pip · error · InstallationError

[dependency-groups] table was missing from '{path}'. Cannot

Error message

[dependency-groups] table was missing from '{path}'. Cannot resolve '--group' option.

What it means

Raised by _build_resolvers() when the pyproject.toml referenced by a `--group` option does not contain a `[dependency-groups]` table at all (req_dependency_group.py:48). pip checks `'dependency-groups' not in pyproject`; if absent, it cannot resolve any group because there is nothing to resolve from.

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 eg

View on GitHub (pinned to d7d0d0a394)

Solutions

  1. Open the relevant pyproject.toml and add a [dependency-groups] table listing the groups you need.
  2. Confirm you are pointing at the correct pyproject.toml path (especially with the `path:group` CLI syntax).
  3. If the project hasn't adopted PEP 735, either add the table or use a different mechanism (extras, requirements files).
  4. Verify the table key is exactly `dependency-groups` (hyphenated, plural).

Example fix

# before (no table in pyproject.toml)
# pip install --group dev  -> error
# after
[dependency-groups]
dev = ["pytest", "ruff"]
Defensive patterns

Strategy: validation

Validate before calling

import tomllib

def assert_has_dependency_groups(path: str) -> None:
    with open(path, "rb") as f:
        data = tomllib.load(f)
    if "dependency-groups" not in data:
        raise ValueError(f"{path} has no [dependency-groups] table; cannot use --group")

Type guard

import tomllib

def pyproject_has_dependency_groups(path: str) -> bool:
    with open(path, "rb") as f:
        return "dependency-groups" in tomllib.load(f)

Try / catch

null

Prevention

When it happens

Trigger: Running `pip install --group dev` against a project whose pyproject.toml has no [dependency-groups] section. Or passing a path (`path:group`) to a pyproject.toml that lacks the table.

Common situations: Expecting a group that was never defined. Working in a project that uses the older extras-dev pattern instead of PEP 735 groups. Typing the group name of a different project. CI that assumes groups exist after a partial migration.

Related errors


AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04). Data as JSON: /data/errors/2a20bd7614aee708.json. Report an issue: GitHub.