python config_error ai_generated true

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

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-11-19First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

The -r path is resolved relative to the current working directory, not to the file that contains the -r line.

generic

中文

-r 路径相对于当前工作目录解析,而不是相对于包含 -r 行的文件。

Workarounds

  1. 98% success
    cd /path/to/project
    pip install -r requirements/base.txt
  2. 95% success
    # requirements.txt at project root
    -r requirements/base.txt
    -r requirements/dev.txt
    pip install -r requirements.txt

Dead Ends

Common approaches that don't work:

  1. 90% fail

    --no-index affects package lookup, not file resolution.

  2. 85% fail

    MANIFEST.in is for sdist contents, not for pip's requirements resolution.

  3. 60% fail

    Changes the base for resolution but may break other relative paths in the same file.