Closed cottsay closed 2 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 87.29%. Comparing base (
9778894
) to head (0a99249
). Report is 1 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi There,
We run into an issue with using colcon-core 0.18.1 with ros2 humble on Ubuntu 22.04 LTS, where 'colcon build' failed to build a custom service interface definition due to braking changes introduced by empy>=4.
$ colcon build
Starting >>> hwadapter_srvs
CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
execute_process(/home/user/Development/rosws/.venv/bin/python3 -m
rosidl_adapter --package-name hwadapter_srvs --arguments-file
/home/user/Development/rosws/build/hwadapter_srvs/rosidl_adapter__arguments__hwadapter_srvs.json
--output-dir
/home/user/Development/rosws/build/hwadapter_srvs/rosidl_adapter/hwadapter_srvs
--output-file
/home/user/Development/rosws/build/hwadapter_srvs/rosidl_adapter/hwadapter_srvs.idls)
returned error code 1:
AttributeError processing template 'srv.idl.em'
Traceback (most recent call last):
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 51, in evaluate_template
em.BUFFERED_OPT: True,
AttributeError: module 'em' has no attribute 'BUFFERED_OPT'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__main__.py", line 19, in <module>
sys.exit(main())
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 53, in main
abs_idl_file = convert_to_idl(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__init__.py", line 24, in convert_to_idl
return convert_srv_to_idl(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/srv/__init__.py", line 39, in convert_srv_to_idl
expand_template('srv.idl.em', data, output_file, encoding='iso-8859-1')
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 23, in expand_template
content = evaluate_template(template_name, data)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 69, in evaluate_template
_interpreter.shutdown()
AttributeError: 'NoneType' object has no attribute 'shutdown'
Call Stack (most recent call first):
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
CMakeLists.txt:15 (rosidl_generate_interfaces)
---
Failed <<< hwadapter_srvs [1.11s, exited with code 1]
We use pip install colcon-common-extensions
in a venv to keep the workspace dependencies from cluttering the base installation.
Downgrading to empy to 3.3.4 resolved the issue for us.
If you can think of an alternative resolution, it would be appreciated. As using the older version is bearable for us at the moment, I decided to put this here for your information, instead of opening an issue.
The problem you're seeing has nothing to do with colcon. The backtrace originates in rosidl_adapter
.
It's the same underlying cause, but your problem has nothing to do with colcon.
Ok, maybe I had a misconception about how independent colcon and ros2 are as projects.
I made this comment here, as the pipdeptree
showed colcon-core
as the package that introduced empy into our python environment, while rosidl_adapter is shown as 'independent'.
And as I assumed colcon provides the building framework for ros2 i made this post here. However, this is probably more an issue we have to handle ourselves, which is the reason I just wanted to bring this to your attention, without opening an Issue.
It's possible that by finally relaxing the constraint in colcon, there were no other pip packages holding EmPy back and pip felt free to finally update it to the latest release, which doesn't happen to be compatible with rosidl_adapter
.
Because ROS packages built from source don't play a role in pip's dependency resolution, pip wasn't aware that updating EmPy would cause problems.
I would say that this is one of many sharp edges you'll experience using package managers other than your platform's default package manager (apt, in your case), and is one of the reasons we've been driving pip dependencies out of the installation instructions.
Nearly all colcon packages are available as deb packages, either in the ROS 2 repositories or the standalone colcon packagecloud repository. I encourage you to consider using that to install colcon and other ROS 2 dependencies rather than resorting to pip, and avoid problems like this in the future.
Requires #666 Closes #627