python config_error ai_generated true

WARNING: Duplicate entry in requirements file: numpy==1.21.0 (line 3) and numpy==1.22.0 (line 5)

ID: python/pip-requirements-duplicate-entry

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2025-11-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.9 active

Root Cause

The same package is listed with different versions in the requirements file, causing ambiguity.

generic

中文

requirements文件中同一包列出了不同版本,导致歧义。

Workarounds

  1. 95% success Remove duplicate and keep only one version
    # Edit requirements.txt to keep only one line
    numpy==1.22.0
  2. 90% success Use pip-compile to resolve dependencies automatically
    pip install pip-tools
    pip-compile requirements.in

Dead Ends

Common approaches that don't work:

  1. Keeping both entries 50% fail

    Pip will use the last occurrence, which may not be intended.

  2. Ignoring the warning 60% fail

    May install unexpected version; conflicts later.