ros2 build_error ai_generated true

SetuptoolsDeprecationWarning: setup.py install is deprecated

ID: ros2/ament-python-setup-deprecated

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

setuptools deprecated setup.py install. Affects ament_python packages. Warning may become error in future setuptools versions.

generic

Workarounds

  1. 80% success Pin setuptools < 58.2.0 only in your build virtualenv
    pip install 'setuptools==58.2.0'  # temporary, for colcon build only
  2. 88% success Migrate to pyproject.toml with [build-system] entry point
    Add pyproject.toml with [build-system] requires=[setuptools, ament-package]
  3. 75% success Set PYTHONDONTWRITEBYTECODE=1 and ignore the warning if builds succeed

Dead Ends

Common approaches that don't work:

  1. Downgrade setuptools to suppress the warning 78% fail

    Pins to old version; breaks other packages that need modern setuptools features

  2. Switch ament_python package to ament_cmake 82% fail

    Requires rewriting the entire build system; ament_python is correct for pure Python packages