pypa/pip · error · InstallationError
not found. Cannot resolve '--group' option.
Error message
{path} not found. Cannot resolve '--group' option. What it means
The pyproject.toml file path specified for '--group' resolution does not exist on the filesystem. The _load_pyproject helper caught a FileNotFoundError and converted it to an InstallationError with a clear message.
Solutions
- Verify the file exists: 'ls pyproject.toml' or 'ls /path/to/pyproject.toml'
- Run pip from the project root directory where pyproject.toml lives
- Create a pyproject.toml if your project does not have one
Defensive patterns
Strategy: validation
Validate before calling
import os
def pyproject_exists(path: str) -> bool:
return os.path.isfile(path)
if not pyproject_exists("pyproject.toml"):
print("pyproject.toml not found — create it or check the path") Type guard
import os
def pyproject_file_exists(path: str) -> bool:
"""Type guard: True if the pyproject.toml file exists."""
return os.path.isfile(path) 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 "not found" in str(e):
print("Create pyproject.toml or verify the working directory")
else:
raise Prevention
- Verify the pyproject.toml path exists before using --group
- Run pip from the project root directory
- Create a pyproject.toml if the project does not have one
When it happens
Trigger: Running 'pip install --group dev' from a directory with no pyproject.toml, or specifying a custom pyproject.toml path that does not exist.
Common situations: Wrong working directory in CI or locally. Deleted or never-created pyproject.toml. Path typo. Running pip from a subdirectory of the project.
Related errors
- [dependency-groups] resolution failed for
- [dependency-groups] table was missing from
- [dependency-groups] data was invalid in
- [dependency-groups] table was malformed in
- Error parsing
AI-assisted analysis of pypa/pip@f399c37189 (2026-08-08).
Data as JSON: /api/errors/d070071d2dfcf7f2.
Report an issue: GitHub.
Appendix: 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 f399c37189)