[Solved] ROS2 error: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other…

Because I have been using c++ all the time, the debugging of ROS + python is relatively small. Today, I encountered a project playing with python and found that an error was reported.

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

Then, the old routine, pull down ros2/example and test rospy,

git clone -b humble –recursive https://github.com/ros2/examples.git src

Then colcon build started, and found that the same error was reported; since the official source code can’t run, it is estimated that it is a problem with the version of the python installation package. python3.8.3 is officially specified, and it is unlikely to have a problem. Following this thread, I found this post,

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. – ROS Answers: Open Source Q & amp;A Forum

Tried it in python, it doesn’t work

>>> print(setuptools.__version__)
Traceback (most recent call last):
File ““, line 1, in
NameError: name ‘setuptools’ is not defined

Then, change it a bit

>>> import setuptools
>>> print(setuptools.__version__)

59.6.0

It may be that the version is too new. As mentioned in the post

pip install setuptools==58.2.0

problem solved.

This article ends.