Unable to launch subscriber in 3.3.1 (ROS Basics)

I get the following output when I use ros2 launch subscriber_pkg subscriber_pkg_launch_file.launch.py in the console.

For more context(not sure if these are relevant):
input: ~/ros2_ws$ ros2 pkg create --build-type ament_python publisher_pkg --dependencies rcply std_msgs geometry_msgs
output: [WARNING]: Unknown license ‘TODO: License declaration’. This has been set in the package.xml, but no LICENSE file has been created.
It is recommended to use one of the ament license identitifers:

input: ~/ros2_ws$ colcon build --packages-select publisher_pkg
output: *Starting >>> publisher_pkg
— stderr: publisher_pkg
/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.

Finished <<< publisher_pkg [3.18s]

Summary: 1 package finished [7.33s]*

Hi @harichandan25 ,

Welcome to this Community!

You are working on Subscriber and posting a Publisher output.
Anyways, your publisher program also has a problem.
Assuming you have copy-pasted the contents of launch file correctly and the program for simple_publisher, there are only two possible reasons you get this error.

  1. You did not compile your program correctly using colcon build ... or you forgot to source your install folder.
  2. It might be because of the SetuptoolsDeprecationWarning

If it is the second case then you must downgrade setuptools:
Issue the following command on terminal:

pip install setuptools==58.2.0

Once installed, rebuild your ROS2 package with colcon build .... Don’t forget to source install folder before launching the program / package.

Try this and let me know if it worked or not.


Hi @girishkumar.kannan ,

My apologies, it was supposed to be a publisher in the title in place of subscriber. And coming back to the problem, I did compile the program correctly. The issue was with the simple_publisher.py file which was not created in the right folder. Once I put it where it belongs everything was fine.

Thank you for your help. Kind regards,

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.