python install_error ai_generated true

error: option --use-2to3 not recognized usage: setup.py [global_opts] cmd1 [cmd1_opts] ... setup.py: error: no such option: --use-2to3

ID: python/setuptools-use-2to3-removed

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.7 active — — —
3.8 active — — —
3.9 active — — —
3.10 active — — —

Root Cause

setuptools 58+ removed the 2to3 build support. Packages with `use_2to3=True` in setup.py now fail because the option no longer exists.

generic

中文

setuptools 58+ 移除了 2to3 构建支持。setup.py 中带有 `use_2to3=True` 的包现在会失败,因为该选项已不存在。

Workarounds

  1. 80% success
    pip install 'setuptools<58' wheel
    pip install --no-build-isolation <package>
  2. 75% success
    pip install --only-binary=:all: <package>

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Many legacy packages are unmaintained; the latest release still contains use_2to3=True.

  2. 95% fail

    The 2to3 tool is part of the stdlib; installing a package named 2to3 does not restore setuptools' removed option.