Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax EmPy version requirement now that v4 is working #667

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Sep 20, 2024

Requires #666
Closes #627

@cottsay cottsay added the enhancement New feature or request label Sep 20, 2024
@cottsay cottsay self-assigned this Sep 20, 2024
@cottsay cottsay added this to the 0.17.2 milestone Sep 23, 2024
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.29%. Comparing base (9778894) to head (0a99249).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #667      +/-   ##
==========================================
- Coverage   87.35%   87.29%   -0.06%     
==========================================
  Files          67       67              
  Lines        3921     3921              
  Branches      775      775              
==========================================
- Hits         3425     3423       -2     
- Misses        392      394       +2     
  Partials      104      104              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cottsay cottsay marked this pull request as ready for review September 23, 2024 13:18
@cottsay cottsay merged commit 77b3034 into master Sep 23, 2024
36 checks passed
@cottsay cottsay deleted the cottsay/empy-requirement branch September 23, 2024 14:30
@lks-dev
Copy link

lks-dev commented Oct 14, 2024

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.

@cottsay
Copy link
Member Author

cottsay commented Oct 14, 2024

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.

@lks-dev
Copy link

lks-dev commented Oct 14, 2024

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.

@cottsay
Copy link
Member Author

cottsay commented Oct 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants