pypa/pip · error · InstallationError

{path} not found. Cannot resolve '--group' option.

Error message

{path} not found. Cannot resolve '--group' option.

What it means

Raised by pip's dependency-groups loader (_load_pyproject) when the pyproject.toml path passed to '--group [path:]group' does not exist on disk. pip catches the FileNotFoundError from open(path,'rb') and converts it into an InstallationError so the CLI exits with a clear message rather than a traceback. The '--group' option resolves PEP 735 dependency groups, which must live in a pyproject.toml.

Source

Thrown at src/pip/_internal/req/req_dependency_group.py:82

            messages = [str(e) for e in eg.exceptions]
            raise InstallationError(
                f"[dependency-groups] data was invalid in {path}: {'; '.join(messages)}"
            ) from eg

    return resolvers


def _load_pyproject(path: str) -> dict[str, Any]:
    """
    This helper loads a pyproject.toml as TOML.

    It raises an InstallationError if the operation fails.
    """
    try:
        with open(path, "rb") as fp:
            return tomllib.load(fp)
    except FileNotFoundError:
        raise InstallationError(f"{path} not found. Cannot resolve '--group' option.")
    except tomllib.TOMLDecodeError as e:
        raise InstallationError(f"Error parsing {path}: {e}") from e
    except OSError as e:
        raise InstallationError(f"Error reading {path}: {e}") from e

View on GitHub (pinned to d7d0d0a394)

Solutions

  1. Verify the path exists: 'ls -l <path>' before running pip.
  2. Pass a path relative to your current working directory, or an absolute path, that points at the real pyproject.toml.
  3. If you only want the current project's groups, use '--group dev' (no path) so pip looks up pyproject.toml automatically.
  4. Check the cwd of your shell/CI step matches where pyproject.toml lives.

Example fix

# before
pip install --group /repo/pyproject.toml:dev

# after (run from /repo, or fix the path)
pip install --group ./pyproject.toml:dev   # or just --group dev
Defensive patterns

Strategy: validation

Validate before calling

import os, sys
path = sys.argv[1]
if not os.path.isfile(path):
    raise SystemExit(f'{path} does not exist; fix the --group path before running pip')

Type guard

def is_valid_group_path(p: str) -> bool:
    import os
    return bool(p) and os.path.isfile(p) and p.endswith(('pyproject.toml', 'toml'))

Try / catch

import os.path
path = './pyproject.toml'
if not os.path.isfile(path):
    print(f'skip: {path} missing')
else:
    run_pip(['install', '--group', f'{path}:dev'])

Prevention

When it happens

Trigger: Invoking 'pip install --group ./missing/pyproject.toml:dev' (or '-c' style constraints referencing a group) where the given path does not resolve to a file. Also triggered by a relative path evaluated from an unexpected working directory, or a typo in the '[path:]group' token where the path portion is taken literally.

Common situations: Running pip from a subdirectory while passing a project-root-relative path; CI checkout that omits the pyproject.toml; typo'd path in a script; sharing a requirements snippet that hardcodes an absolute path that differs across machines.

Related errors


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