python data_error ai_generated true

ERROR: Invalid requirement: 'package == 1.0.0'

ID: python/pip-install-error-invalid-requirement-whitespace

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

The requirement string contains spaces around the operator, which is not allowed in pip requirement syntax.

generic

中文

依赖项字符串在运算符周围包含空格,这在 pip 依赖项语法中是不允许的。

Workarounds

  1. 99% success
    pip install package==1.0.0
  2. 95% success
    echo 'package==1.0.0' > requirements.txt && pip install -r requirements.txt
  3. 85% success
    Refer to pip's documentation on requirement specifiers.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Quoting does not fix the whitespace issue.

  2. 95% fail

    Newer pip still enforces no whitespace around operators.

  3. 95% fail

    Force reinstall does not bypass parsing.