python data_error ai_generated true

ERROR: Invalid requirement: '-e git+https://github.com/org/repo.git@main#egg=foo' (from line 3 of requirements.txt) Hint: It looks like a path. File 'requirements.txt' does not exist.

ID: python/pip-requirement-parse-invalid-editable

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8+ active — — —

Root Cause

pip parsed a requirement line incorrectly, often due to a stray space after -e, a BOM/encoding issue, or the line being read as an argument rather than a requirement.

generic

中文

pip 错误解析需求行,通常由于 -e 后多余空格、BOM/编码问题,或该行被当作参数而非需求读取。

Workarounds

  1. 92% success
    # requirements.txt
    -e git+https://github.com/org/repo.git@main#egg=foo
    # ensure UTF-8 without BOM; one requirement per line
  2. 88% success
    python -c "import sys; open('requirements.txt', encoding='utf-8-sig').read()"
    # convert BOM:
    sed -i '1s/^\xEF\xBB\xBF//' requirements.txt
    pip install -r requirements.txt

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Loses editable mode; changes how the package resolves imports and breaks local development workflow.

  2. 85% fail

    pip does not strip shell-style quotes from requirements lines; the quoted string becomes an invalid requirement.