pypa/pip · error · InstallationError

Error reading {path}: {e}

Error message

Error reading {path}: {e}

What it means

Raised when the pyproject.toml for '--group' exists and parses location-wise but cannot be read due to a generic OSError (everything other than FileNotFoundError and TOMLDecodeError, which have their own handlers). Typical causes are permission denied or an I/O error reading the file.

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 d7d0d0a394)

Solutions

  1. Check permissions/ownership: 'ls -l <path>' and 'id'.
  2. Grant read access: 'chmod +r <path>' or adjust ownership with chown.
  3. If a symlink, confirm the target exists: 'readlink -f <path>'.
  4. Re-mount the volume read/write if running inside a container with a read-only bind mount.

Example fix

# before: file mode 000 or no read bit
chmod 000 pyproject.toml && pip install --group ./pyproject.toml:dev

# after
chmod 644 pyproject.toml && pip install --group ./pyproject.toml:dev
Defensive patterns

Strategy: validation

Validate before calling

import os, sys
path = sys.argv[1]
if not os.access(path, os.R_OK):
    raise SystemExit(f'{path} not readable; fix permissions before running pip')

Type guard

def is_readable(path: str) -> bool:
    import os
    return os.path.isfile(path) and os.access(path, os.R_OK)

Try / catch

import os
try:
    with open(path, 'rb') as f:
        f.read(1)
    run_pip(['install', '--group', f'{path}:dev'])
except OSError as e:
    print(f'cannot read {path}: {e}; fix perms/mount then retry')

Prevention

When it happens

Trigger: Calling '--group ./pyproject.toml:dev' where the file exists but open(path,'rb') raises PermissionError (mode 000 or owned by another user with no read bit), or a broken symlink, or a filesystem I/O error (NFS hiccup, disk error).

Common situations: Files created by a different user/container without read permission; read-only mounts in CI; dangling symlinks; container user mismatch between the layer that wrote pyproject.toml and the one running pip.

Related errors


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