Skip to content

Instantly share code, notes, and snippets.

@gentijo
Created December 21, 2023 22:12
Show Gist options
  • Save gentijo/71b30acc06c7aa25e2ea86358c9bf8bc to your computer and use it in GitHub Desktop.
Save gentijo/71b30acc06c7aa25e2ea86358c9bf8bc to your computer and use it in GitHub Desktop.
ROS Ament error
**Copied from MicroROS slack thread**
**My Initial question**
Hi, my MicroROS project recently started to fail after I run clean.
If I restore it from a backup it compiles fine until i run clean/compile.I am running inside a container
that is based off of espressif/idf:v4.4.6 and my host OS is Ubuntu 22.04My docker def is here
https://github.com/gentijo/ROSMicroPy/blob/main/docker/Dockerfile.rbpyMy
[micro_ros_espidf_component](https://github.com/micro-ROS/micro_ros_espidf_component) is installed as a sub component
the version is from a previous version of Humble,
[895a1f8](https://github.com/micro-ROS/micro_ros_espidf_component/tree/895a1f8858481d0b39a0d76d5ee8ab4db932293f),
which is roughly 3.0.1 which is a bit old but I tried to update to the latest Humble but the error is the same.
I am getting a syntax error when ament is running
My container Python version is Python 3.8.10I have a feeling that this happened after running apt upgrade some time
in the past but I am lost on how to debug this.Has anyone seen this before ??
Any ideas where to look ??
Thank you
John
Failed <<< ament_cppcheck [0.44s, exited with code 1]
--- stderr: ament_pycodestyle
Traceback (most recent call last):
File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/colcon_core/executor/__init__.py", line 91, in __call__
rc = await self.task(*args, **kwargs)
File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/colcon_core/task/__init__.py", line 93, in __call__
return await task_method(*args, **kwargs)
File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/colcon_ros/task/ament_python/build.py", line 51, in build
setup_py_data = get_setup_data(self.context.pkg, env)
File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/colcon_core/task/python/__init__.py", line 20, in get_setup_data
return dict(pkg.metadata[key](env))
File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/colcon_ros/package_augmentation/ros_ament_python.py", line 57, in getter
return get_setup_information(
File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-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 "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 293, in _get_setup_information
return ast.literal_eval(output)
File "/usr/lib/python3.8/ast.py", line 59, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/usr/lib/python3.8/ast.py", line 47, in parse
return compile(source, filename, mode, flags,
File "<unknown>", line 1
{'package_data': {'': ['configuration/ament_pycodestyle.ini']}, 'dist_files': [], 'src_root': None, 'dependency_links': [], 'setup_requires': [], 'cffi_modules': None, 'eager_resources': None, 'entry_points': {'console_scripts': ['ament_pycodestyle = ament_pycodestyle.main:main']}, 'exclude_package_data': None, 'extras_require': {}, 'include_package_data': None, 'install_requires': ['setuptools'], 'namespace_packages': None, 'packages': ['ament_pycodestyle'], 'python_requires': None, 'test_loader': None, 'test_runner': None, 'test_suite': None, 'tests_require': ['pytest'], 'use_2to3': None, 'zip_safe': False, 'verbose': 1, 'dry_run': 0, 'help': 0, 'command_packages': None, 'script_name': 'setup.py', 'script_args': ['--dry-run'], 'command_options': {'install': {}}, 'package_dir': {}, 'py_modules': None, 'libraries': None, 'headers': None, 'ext_package': None, 'include_dirs': None, 'extra_path': None, 'scripts': None, 'data_files': [('share/ament_pycodestyle', ['package.xml']), ('share/ament_index/resource_index/packages', ['resource/ament_pycodestyle'])], 'password': '', 'command_obj': {}, 'have_run': {}, 'want_user_cfg': True, 'metadata': {'name': 'ament_pycodestyle', 'version': '0.12.9', 'author': 'Removed PII', 'maintainer': 'removed pii', 'maintainer_email': 'removed PII', 'url': 'https://github.com/ament/ament_lint', 'license': 'Apache License, Version 2.0', 'description': 'Check Python code style using pycodestyle.', 'long_description': 'The ability to check code against the style conventions in PEP 8 and\ngenerate xUnit test result files.', 'keywords': ['ROS'], 'platforms': None, 'classifiers': ['Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', 'Topic :: Software Development'], 'download_url': 'https://github.com/ament/ament_lint/releases', 'provides': None, 'requires': None, 'obsoletes': None, 'long_description_content_type': None, 'project_urls': {}, 'license_file': None, '_normalized_install_requires': {'setuptools': <Requirement('setuptools')>}, '_normalized_extras_require': {}}}
SyntaxError: invalid syntax
**My analysis and solution**
Solved. I had a previous computer that worked fine. It has all the same setup, Ubuntu 22.04,
Docker versions and same build profile. Difference was the container was built about a month ago
vs the new computer in the last few days. I did a pip list on both containers, a few of the modules
were newer based on the last time pip was run but they were only different by a point release.
This was the cause of the problem. It's not the difference of colcon-core, I tried that one by itself.
I created a requirments.txt from the old computer and applied it to the new computer and it all worked.
There must been a release in the past few weeks that has broken colcon/ament.
Pip List - New Computer (Contianer on new computer)
https://drive.google.com/file/d/1AtAQGIQDSbCJV6AEovg9QmA2rV785zb3/view?usp=sharing
Pip List - Old Computer (Container on Old Computer)
https://drive.google.com/file/d/1pb7ZqtRT-evAL4LWIotoV4nKvWsfPy2I/view?usp=drive_link
Requirments.txt representing state of older computer with Working state
https://docs.google.com/document/d/1783XQmMB8mWHYnP01Q1gFh2RF9phUZH0XQaBw-cjRQM/edit?usp=drive_link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment