pypa/pip · error · InstallationError
Error reading
Error message
Error reading {path}: {e} What it means
An OS-level error other than FileNotFoundError or TOMLDecodeError occurred while reading pyproject.toml for dependency-group resolution. This is typically a permission denied, or a disk/IO error. The generic OSError is caught and wrapped.
Solutions
- Check file permissions: 'ls -l pyproject.toml' and ensure you have read access
- Fix ownership or permissions: 'chmod +r pyproject.toml' or 'chown $USER pyproject.toml'
- If on a network filesystem, verify connectivity and retry
- On Windows, check the file is not locked by another process
Defensive patterns
Strategy: validation
Validate before calling
import os
def is_readable(path: str) -> bool:
return os.path.isfile(path) and os.access(path, os.R_OK)
if not is_readable("pyproject.toml"):
print("pyproject.toml is not readable — check permissions") Type guard
import os
def is_readable_file(path: str) -> bool:
"""Type guard: True if path is a readable file."""
return os.path.isfile(path) and os.access(path, os.R_OK) 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 "Error reading" in str(e):
print("Check file permissions: chmod +r pyproject.toml")
else:
raise Prevention
- Check file permissions with 'ls -l pyproject.toml' before running pip
- Ensure the CI user has read access to pyproject.toml
- On network filesystems, verify connectivity if intermittent I/O errors occur
When it happens
Trigger: pyproject.toml exists but cannot be opened due to restrictive file permissions, or the filesystem is experiencing I/O errors. A race condition where the file is deleted between the existence check and the open call.
Common situations: File owned by root or another user with no read permission. Docker volume mount issues. Network filesystem (NFS) hiccups. File locked by another process on Windows.
Related errors
- [dependency-groups] resolution failed for
- [dependency-groups] table was missing from
- Error parsing
- not found. Cannot resolve '--group' option.
- An error occurred while writing to the configuration file
AI-assisted analysis of pypa/pip@f399c37189 (2026-08-08).
Data as JSON: /api/errors/0fbb9f463fd72aeb.
Report an issue: GitHub.
Appendix: source
Thrown at src/pip/_internal/req/req_dependency_group.py:86
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)