python install_error ai_generated true

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

ID: python/setuptools-deprecated-use-of-setup-py

Also available as: JSON · Markdown · 中文
80%Fix Rate
90%Confidence
0Evidence
2024-03-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

The user invoked `python setup.py install` (or a tool that does) instead of using pip/build. Modern setuptools warns and will eventually remove this path.

generic

中文

用户调用了 `python setup.py install`(或调用它的工具),而不是使用 pip/build。现代 setuptools 会告警,并最终移除该路径。

Workarounds

  1. 95% success
    Replace `python setup.py install` with:
      python -m pip install .
    For editable installs:
      python -m pip install -e .
    For building distributions:
      python -m build
  2. 85% success
    If you maintain the package, migrate metadata from setup.py to pyproject.toml [project] table and keep setup.py only as a shim.

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Hides the symptom but the legacy path is still used and will break in future setuptools releases.

  2. 85% fail

    Downgrading setuptools breaks other packages that require modern setuptools for PEP 517/518 builds.