python config_error ai_generated true

ValueError: Unknown distribution option: 'long_description_content_type'

ID: python/setuptools-long-description-content-type-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-01-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active

Root Cause

The setup.py uses a keyword argument that is not recognized by the installed version of setuptools (e.g., older setuptools).

generic

中文

setup.py 使用了已安装的 setuptools 版本不识别的关键字参数(例如较旧的 setuptools)。

Workarounds

  1. 95% success Upgrade setuptools to a version that supports this option
    `pip install --upgrade setuptools>=40.0`
  2. 90% success Use pyproject.toml to specify the content type
    In pyproject.toml: `[project]
    ...
    description = "..."
    readme = "README.md"` (which implies content type)

Dead Ends

Common approaches that don't work:

  1. Removing long_description_content_type entirely 40% fail

    This may cause the long description to be rendered as plain text on PyPI, losing formatting.

  2. Using a different name like 'content_type' 80% fail

    The correct parameter name is 'long_description_content_type'; any other name is invalid.