python config_error ai_generated true

ERROR: Invalid requirement: '-e git+https://github.com/user/repo.git#egg=package' - Expected a valid requirement name

ID: python/pip-requirements-file-parse-error

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active

Root Cause

The editable install format in requirements.txt is malformed, often missing the -e flag or incorrect URL syntax.

generic

中文

requirements.txt 中的可编辑安装格式格式错误,通常缺少 -e 标志或 URL 语法不正确。

Workarounds

  1. 95% success Use the correct editable install format
    In requirements.txt: `-e git+https://github.com/user/repo.git#egg=package` (ensure no extra characters).
  2. 90% success Install directly with pip using the -e flag
    `pip install -e git+https://github.com/user/repo.git#egg=package`

Dead Ends

Common approaches that don't work:

  1. Removing the -e flag and treating it as a regular URL 60% fail

    Without -e, pip will try to install from the URL but may not handle it as an editable install.

  2. Adding extra spaces around the URL 80% fail

    The syntax is strict; extra spaces may break parsing.