tf2 tutorial compile failure
I am running Ubuntu 20.04.3 LTS and following the tf2 tutorials at https://docs.ros.org/en/foxy/Tutorial.... I have managed the static broadcaster OK but can not get the above link to compile. I have installed all the dependencies defined in the static broadcaster tutorial and get a far as Step 3 Build & run in the linked tutorial. However I can not get it to compile. I use the directory ros2_foxy as my equivalent of dev_ws so that I can more easily migrate to galactic. This is my .bashrc_ros which I link at the end of .bashrc whenever a new terminal is opened.
source /opt/ros/foxy/setup.bash
export ROS_DOMAIN_ID=1
cd /home/brian/ros2_foxy/
source install/local_setup.bash
This is the command I enter and the full output
brian@HP-notebook:~/ros2_foxy$ colcon build --symlink-install --packages-select learning_tf2_py Starting >>> learning_tf2_py Traceback (most recent call last):2_py - 0.2s]
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/distutils/core.py", line 215, in run_setup exec(f.read(), g) File "<string>", line 13, in <module> NameError: name 'os' is not defined --- stderr: learning_tf2_py Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__ rc = await self.task(args, *kwargs) File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__ return await task_method(args, *kwargs) File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 51, in build setup_py_data = get_setup_data(self.context.pkg, env) File "/usr/lib/python3/dist-packages/colcon_core/task/python/__init__.py", line 20, in get_setup_data return dict(pkg.metadatakey) File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 129, in getter return get_setup_information( File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information _setup_information_cache[hashable_env] = _get_setup_information( File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 281, in _get_setup_information result = subprocess.run( File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup( 'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {
key: value for key, value in dist.__dict__.items() if (
not key.startswith('_') and
not callable(value) and key not in skip_keys and key not in dist.display_option_names
)};data['metadata'] = { k: v for k, v in dist.metadata.__dict__.items()
if k not in ('license_files', 'provides_extras')};sys.stdout.buffer.write(repr(data).encode('utf-8'))"]' returned non-zero exit status 1. --- Failed <<< learning_tf2_py [0.26s, exited with code 1]Summary: 0 packages finished [0.36s]
1 package failed: learning_tf2_py 1 package had stderr output: learning_tf2_py Command '['/usr/bin/python3', '-c', "import sys;from setuptools.extern.packaging.specifiers import SpecifierSet;from distutils.core import run_setup;dist = run_setup( 'setup.py', script_args=('--dry-run',), stop_after='config');skip_keys = ('cmdclass', 'distclass', 'ext_modules', 'metadata');data = {
key: value for key, value in dist.__dict__.items() if (
not key.startswith ...
This looks like a Python environment problem. This is a complex topic, and I am not an expert, but I have screwed up my Python environment a few times. :-/ Try building inside a docker container like osrf/ros:foxy-desktop to see if it works there.
I have not used Docker so it will take me a while to familiarise myself with it and then set up an environment. I'll add the results later.
try to delete build/ install/ log/ then redo the colcon build
Having the deleted the above directories I then get a "missing turtlesim" error on build. If I then build turtleseim and retry to build learning_tf2_py I get the same error.
you downloaded tf2_py from the github, right? If so, go in that directory and git branch then let me know what you see. I can help you on here in real time for next 20 minutes.
I realised I had not tried the demo launch file in the static tutorial. This also fails with a similar message. Plan of attack :- 1. Retry everything on a pi4+ with 4Gb to eliminate environment issues 2. Boot laptop to Windows to check for firmware updates (laptop < 1 yr old) 3. Continue Docker training raising issues on their forums. As I have other things to do this may take several days.
bad news is that it failed on the Pi4 with the same error. Firmware update were made to the laptop with the same result. Pausing to think it through and later try to sort docker (where I will raise issues on their site)
Ah, hold off on the docker idea. I mislead you. I just ran the tutorial and was able to re-create your problem. I don't have any experience building Python-only ROS2 packages, so it might take me a while to figure out the bug, but at this point I think it's a bug in the tutorial. (Any other ROS Python power-users feel free to jump in!)