python
config_error
ai_generated
true
error: error in 'egg_info' command: 'NoneType' object has no attribute 'get'
ID: python/pip-egg-info-metadata-generation-failed
80%Fix Rate
82%Confidence
0Evidence
2024-07-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
A malformed or partially missing setup.cfg/pyproject.toml section causes setuptools' metadata reader to receive None where a dict is expected during egg_info generation.
generic中文
setup.cfg/pyproject.toml 段落格式错误或缺失,导致 setuptools 的元数据读取器在 egg_info 生成过程中收到 None 而非 dict。
Workarounds
-
85% success
Validate config: python -c "import configparser,sys; c=configparser.ConfigParser(); c.read('setup.cfg'); print(dict(c['metadata']))" -
90% success
Move metadata into pyproject.toml's [project] table and remove the conflicting setup.cfg section
-
80% success
Run python setup.py egg_info -v to see the full traceback and locate the offending key
Dead Ends
Common approaches that don't work:
-
85% fail
Isolation is not the cause; the malformed metadata file still breaks egg_info.
-
80% fail
The stale directory is regenerated from the same malformed config, reproducing the error.
-
70% fail
A newer setuptools may produce a clearer error but still cannot parse an invalid config.