# SetuptoolsDeprecationWarning in ros2 Humble

I was trying to follow this tutorial in the official documentation of ros2 Humble for Integrating launch files into ROS 2 packages and ran in to the below given error after doing trying to perform a build on the package using

colcon build --packages-select py_launch_example


The package build compilation given me the following error.

Starting >>> py_launch_example
[3.759s] WARNING:colcon.colcon_ros.task.ament_python.build:Package 'py_launch_example' doesn't explicitly install a marker in the package index (colcon-ros currently does it implicitly but that fallback will be removed in the future)
[3.793s] WARNING:colcon.colcon_ros.task.ament_python.build:Package 'py_launch_example' doesn't explicitly install the 'package.xml' file (colcon-ros currently does it implicitly but that fallback will be removed in the future)
--- stderr: py_launch_example
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
---
Finished <<< py_launch_example [1.23s]

Summary: 1 package finished [4.38s]
1 package had stderr output: py_launch_example


• operating system : Ubuntu 22.04 LTS
• ROS Distro : Humble
• Python version : 3.10.6

Solutions I have tried :

1. Downgrading the setuptools to older version 58.2.0, this actually worked for me and the warning was no longer shown.
2. removing the line install_requires=['setuptools'] from the setup.py file and use --allow-overriding tag while rebuilding. This solution didn't work for me.
• What solution did you try to use? And why wasn't it permanent? Dec 28, 2022 at 22:20
• Also note that this is a warning and not an error. You can continue to use it with these errors, it will become an error in the future when the depreciated capability is removed. Dec 28, 2022 at 22:22
• If we wanted to get started now fixing this before it becomes an error, what would we do? Maybe there is a package that made the required changes and the corresponding PR is a good example to follow presumably in every package that shows the warning? Or is it a matter of modifying/refactoring colcon itself? Dec 29, 2022 at 23:16
• @Tully, I have tried solutions mentioned here. First I downgraded the setup-tools package to a lower version, it worked for me, the warning went off and was able to proceed with launching the program. I have also tried removing the install_requires=['setuptools'] provided in third solution in the same link, but it didn't work. I mentioned this solution is not permanent because it involved downgrading a python package which is not recommended Jan 1 at 16:12
• These are all important parts of your question. You should edit it to include this important information. And when you do, you should update your description to reflect that it did actually work, and it is permanent. But you would rather a different way and what your specific constraints are that aren't met by the existing answers, aka you don't want to downgrade. But know that if you ask for too many constraints it may not be something achievable. Aka the answer from @Dave is going to be your best advice. Deprecation cycles are non-zero length for a reason while new solutions are implemented. Jan 3 at 7:22

It is a warning message, which affects Humble. The problem is the newest version of setuptools. Look here for a possible solution. Basically you should downgrade setuptools to 58.2.0. Personally I leave setuptools to the last version. Since this is a warning and not an error, it is annoying but not a problem. Probably it is going to disappear after the next update of setuptools. Downgrade is never a good option (to me)

• Thanks for the reply actually, I have referred the same link for the answer and never got a satisfactory answer :( Jan 1 at 16:14
• I know, satisfactory is not. I have the same issue and prefer to keep that warning instead of downgrading my system. I downgraded it once (another package) and the result was that I destroy completely all the rest of my environment. After that experience, I won't downgrade anymore
– Dave
Jan 1 at 21:27

I'm pretty familiar with this issue, and we're not quite ready to move to the new APIs that the setuptools folks are deprecating the current workflows in favor of. This post has a robust, if somewhat outdated, summary of some of the hurdles: https://github.com/colcon/colcon-core/issues/454#issuecomment-1262592774

As an alternative to downgrading setuptools, you could use the PYTHONWARNINGS environment variable to suppress that particular warning. I added this to my .bashrc and it works well:

PYTHONWARNINGS="ignore:setup.py install is deprecated::setuptools.command.install"; export PYTHONWARNINGS