{"id":"d070071d2dfcf7f2","repo":"pypa/pip","slug":"path-not-found-cannot-resolve-group-option","errorCode":null,"errorMessage":"{path} not found. Cannot resolve '--group' option.","messagePattern":"(.+?) not found\\. Cannot resolve '--group' option\\.","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/req/req_dependency_group.py","lineNumber":82,"sourceCode":"            messages = [str(e) for e in eg.exceptions]\n            raise InstallationError(\n                f\"[dependency-groups] data was invalid in {path}: {'; '.join(messages)}\"\n            ) from eg\n\n    return resolvers\n\n\ndef _load_pyproject(path: str) -> dict[str, Any]:\n    \"\"\"\n    This helper loads a pyproject.toml as TOML.\n\n    It raises an InstallationError if the operation fails.\n    \"\"\"\n    try:\n        with open(path, \"rb\") as fp:\n            return tomllib.load(fp)\n    except FileNotFoundError:\n        raise InstallationError(f\"{path} not found. Cannot resolve '--group' option.\")\n    except tomllib.TOMLDecodeError as e:\n        raise InstallationError(f\"Error parsing {path}: {e}\") from e\n    except OSError as e:\n        raise InstallationError(f\"Error reading {path}: {e}\") from e\n","sourceCodeStart":64,"sourceCodeEnd":87,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/req/req_dependency_group.py#L64-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the path exists: 'ls -l <path>' before running pip.","Pass a path relative to your current working directory, or an absolute path, that points at the real pyproject.toml.","If you only want the current project's groups, use '--group dev' (no path) so pip looks up pyproject.toml automatically.","Check the cwd of your shell/CI step matches where pyproject.toml lives."],"exampleFix":"# before\npip install --group /repo/pyproject.toml:dev\n\n# after (run from /repo, or fix the path)\npip install --group ./pyproject.toml:dev   # or just --group dev","handlingStrategy":"validation","validationCode":"import os, sys\npath = sys.argv[1]\nif not os.path.isfile(path):\n    raise SystemExit(f'{path} does not exist; fix the --group path before running pip')","typeGuard":"def is_valid_group_path(p: str) -> bool:\n    import os\n    return bool(p) and os.path.isfile(p) and p.endswith(('pyproject.toml', 'toml'))","tryCatchPattern":"import os.path\npath = './pyproject.toml'\nif not os.path.isfile(path):\n    print(f'skip: {path} missing')\nelse:\n    run_pip(['install', '--group', f'{path}:dev'])","preventionTips":["Always resolve --group paths from a known base dir using os.path.join.","In CI, 'test -f pyproject.toml' before invoking pip --group.","Prefer pathless '--group <name>' so pip locates pyproject.toml itself."],"tags":["dependency-groups","pep735","filesystem","config"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}