python config_error ai_generated true

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

ID: python/pip-req-file-not-found

Also available as: JSON · Markdown · 中文
80%Fix Rate
90%Confidence
0Evidence
2024-03-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

pip is invoked from a directory that does not contain the requirements file, or the filename is misspelled (e.g. requirements-dev.txt).

generic

中文

pip 是从不包含 requirements 文件的目录调用的,或文件名拼写错误(例如 requirements-dev.txt)。

Workarounds

  1. 98% success
    pwd
    ls requirements*.txt
    pip install -r "$(pwd)/requirements.txt"
  2. 90% success
    pip freeze > requirements.txt
    pip install -r requirements.txt

Dead Ends

Common approaches that don't work:

  1. 95% fail

    The error is a missing file, not a pip bug; upgrading does not create the file.

  2. 95% fail

    --no-cache-dir affects the HTTP cache, not file lookup; the same FileNotFoundError occurs.