python install_error ai_generated partial

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

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

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

Version Compatibility

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

Root Cause

setuptools removed the 2to3 build option (deprecated since 2018, removed in setuptools 58). Old setup.py files passing use_2to3=True to setup() now fail.

generic

中文

setuptools 移除了 2to3 构建选项(2018 年起弃用,setuptools 58 移除)。向 setup() 传入 use_2to3=True 的旧 setup.py 现在会失败。

Workarounds

  1. 80% success
    pip install 'setuptools<58' wheel
    pip install <old-package> --no-build-isolation
  2. 70% success
    # edit setup.py: remove use_2to3=True
    # then
    pip install . --no-build-isolation
  3. 65% success
    pip index versions <alternative-package>
    pip install <maintained-fork>

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Latest setuptools still has no 2to3 support.

  2. 85% fail

    The option was removed from setuptools, not just pip.

  3. 60% fail

    Sometimes there is no newer release; the package is abandoned.