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
80%Fix Rate
85%Confidence
0Evidence
2025-11-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
Root Cause
The same package is listed with different versions in the requirements file, causing ambiguity.
generic中文
requirements文件中同一包列出了不同版本,导致歧义。
Workarounds
-
95% success Remove duplicate and keep only one version
# Edit requirements.txt to keep only one line numpy==1.22.0
-
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:
-
Keeping both entries
50% fail
Pip will use the last occurrence, which may not be intended.
-
Ignoring the warning
60% fail
May install unexpected version; conflicts later.