Error Knowledge Base pip REQUIREMENTS_FILE_NOT_FOUND

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

pip was asked to install from a requirements file path that does not exist (wrong filename, wrong directory, or missing checkout).

What pip Could Not Find

pip was asked to install from a requirements file path that does not exist (wrong filename, wrong directory, or missing checkout).

Check the exact package name, version, and source

List files in your current directory:ls -la

Confirm the filename is exactly requirements.txt (plural is the common convention).

If you are in CI, confirm the repo was checked out and your job runs from the right working directory.

Confirm the exact package you asked for

Run the command from the directory containing the file, or pass the correct relative/absolute path to -r.

Fix typos (requirements.txt vs requirement.txt).

If the file truly doesn't exist, generate one only if appropriate:python -m pip freeze > requirements.txt (note: this captures your current environment, which may not match a project).

Why It Was Not Found

Most of the time this comes down to a typo, a wrong mirror or registry, a missing platform build, or a version that exists somewhere else but not in the source this environment is querying.

You ran the command from a directory that doesn't contain the file.

The file is named differently (common typo:requirement.txt).

The repository checkout is incomplete or the file was not committed.

Prove the Source Resolves Correctly Now

Run python -m pip install -r requirements.txt and confirm pip begins installing packages, and if you're using a custom path, confirm it resolves correctly with python -c 'import pathlib; print(pathlib.Path("path/to/requirements.txt").resolve())'.

Typical Output

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirement.txt'

How pip reads requirements files

This is the part worth understanding if the quick fix did not hold. It explains what pip is trying to do at the moment the error appears.

When you run pip install -r requirements.txt, pip opens the file path and parses each requirement line.

If the path is wrong or the file isn't present in the current working directory, pip fails before it can install anything.

Avoid Version and Source Drift

To prevent this, keep requirements.txt in a predictable location and document it, in CI, set the working directory explicitly before running pip, and use lock files or pinned requirements for reproducibility where possible.

Docs and source code

github.com/pypa/pip/blob/25.3/src/pip/_internal/req/req_file.py

pip reads requirements files from a URL or a local path, if opening the path fails, it raises an InstallationError with "Could not open requirements file: ...". - GitHub

# Assume this is a bare path.
try:
    with open(url, "rb") as f:
        raw_content = f.read()
except OSError as exc:
    raise InstallationError(f"Could not open requirements file: {exc}")

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list