python
config_error
ai_generated
true
WARNING: Ignoring invalid distribution -ip (c:\python311\lib\site-packages) ERROR: Invalid requirement: 'foo=>1.0' (from line 1 of requirements.txt) Hint: = is not a valid operator. Did you mean == ?
ID: python/pip-requires-python-metadata-missing
80%Fix Rate
82%Confidence
0Evidence
2024-06-11First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
The requirements file uses an invalid version operator (=> instead of >=) or a malformed specifier that packaging rejects. Additionally a partially uninstalled distribution left a '~ip' or '-ip' stub directory in site-packages.
generic中文
requirements 文件使用了无效的版本运算符(=> 而非 >=)或 packaging 拒绝的格式错误说明符。此外,部分卸载的发行版在 site-packages 中残留了 '~ip' 或 '-ip' 存根目录。
Workarounds
-
93% success
sed -i 's/=>/>=/g' requirements.txt # remove leftover '~' dirs find $(python -c 'import site; print(site.getsitepackages()[0])') -maxdepth 1 -name '~*' -exec rm -rf {} + pip install -r requirements.txt -
90% success
python -c "from packaging.requirements import Requirement; [Requirement(l) for l in open('requirements.txt') if l.strip() and not l.startswith('#')]"
Dead Ends
Common approaches that don't work:
-
90% fail
The syntax error is in the requirements file, not pip; upgrading changes nothing and the invalid operator still fails.
-
70% fail
Overly destructive; breaks the base interpreter and does not fix the malformed requirements line.