python config_error ai_generated true

ERROR: Invalid requirement: 'git+https://github.com/org/repo.git#egg=my-pkg&subdirectory=src'

ID: python/pip-egg-fragment-not-supported

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2025-01-08First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

The egg fragment contains multiple '&'-joined parameters; pip's requirement parser accepts only a single #egg=name or #subdirectory= in the URL fragment.

generic

中文

egg 片段包含多个用 '&' 连接参数;pip 的依赖解析器只接受 URL 片段中的单个 #egg=name 或 #subdirectory=。

Workarounds

  1. 95% success
    # requirements.txt
    git+https://github.com/org/[email protected]#subdirectory=src
    # or
    git+https://github.com/org/[email protected]#egg=my-pkg
  2. 85% success
    pip install 'git+https://github.com/org/[email protected]' --config-settings editable_mode=compat
    # or clone + install
    pip install ./repo/src

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Quotes become part of the URL and are still parsed as an invalid requirement.

  2. 80% fail

    The parser still sees two fragment parameters after decoding and rejects the requirement.