You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行colcon build时遇em模块无BUFFERED_OPT属性错误求助

编译RealSense-ROS时遇到AttributeError: module 'em' has no attribute 'BUFFERED_OPT'错误

按照RealSense-ROS源码安装教程执行colcon build步骤时,出现如下CMake错误:

AttributeError: module 'em' has no attribute 'BUFFERED_OPT'

我的ros2_ws/src目录下包含realsense-ros、vision_opencv和xacro,其中后两者是为解决rosdep install时的依赖缺失问题添加的。

软件版本信息

  • 操作系统:Debian 12
  • ROS发行版:Jazzy
  • RealSense SDK:librealsense-2.47.0
  • RealSense ROS wrapper:realsense-ros 3.2.2
  • C编译器:GNU 12.2.0
  • ament_cmake_ros:0.12.0
  • Python:3.11.2
  • em库:python3-empy 3.3.4-2

完整错误日志

user@device:~/ros2_ws $ colcon build
Starting >>> cv_bridge
Starting >>> realsense2_camera_msgs
Starting >>> image_geometry
Starting >>> xacro
--- stderr: realsense2_camera_msgs
CMake Error at /opt/ros/jazzy/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:57 (message):
  execute_process(/usr/bin/python3 -m rosidl_adapter --package-name
  realsense2_camera_msgs --arguments-file
  /home/pi/ros2_ws/build/realsense2_camera_msgs/rosidl_adapter__arguments__realsense2_camera_msgs.json
  --output-dir
  /home/pi/ros2_ws/build/realsense2_camera_msgs/rosidl_adapter/realsense2_camera_msgs
  --output-file
  /home/pi/ros2_ws/build/realsense2_camera_msgs/rosidl_adapter/realsense2_camera_msgs.idls)
  returned error code 1:

  AttributeError processing template 'msg.idl.em'

  Traceback (most recent call last):

    File "/opt/ros/jazzy/lib/python3.11/site-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 "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "/opt/ros/jazzy/lib/python3.11/site-packages/rosidl_adapter/__main__.py", line 19, in <module>
      sys.exit(main())
               ^^^^^^
    File "/opt/ros/jazzy/lib/python3.11/site-packages/rosidl_adapter/main.py", line 53, in main
      abs_idl_file = convert_to_idl(
                     ^^^^^^^^^^^^^^^
    File "/opt/ros/jazzy/lib/python3.11/site-packages/rosidl_adapter/__init__.py", line 19, in convert_to_idl
      return convert_msg_to_idl(
             ^^^^^^^^^^^^^^^^^^^
    File "/opt/ros/jazzy/lib/python3.11/site-packages/rosidl_adapter/msg/__init__.py", line 39, in convert_msg_to_idl
      expand_template('msg.idl.em', data, output_file, encoding='iso-8859-1')
    File "/opt/ros/jazzy/lib/python3.11/site-packages/rosidl_adapter/resource/__init__.py", line 23, in expand_template
      content = evaluate_template(template_name, data)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/ros/jazzy/lib/python3.11/site-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/jazzy/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:132 (rosidl_adapt_interfaces)
  CMakeLists.txt:22 (rosidl_generate_interfaces)


---
Failed <<< realsense2_camera_msgs [4.00s, exited with code 1]
Aborted <<< xacro [9.19s]
Aborted <<< image_geometry [1min 3s]
Aborted <<< cv_bridge [1min 51s]

Summary: 0 packages finished [1min 52s]
  1 package failed: realsense2_camera_msgs
  3 packages aborted: cv_bridge image_geometry xacro
  2 packages had stderr output: realsense2_camera_msgs xacro
  4 packages not processed

已尝试的无效解决方案

  • 更新所有依赖版本并清理编译日志
  • 卸载em并通过apt install python3-empy命令安装empy

恳请各位提供解决帮助!

内容的提问来源于stack exchange,提问作者Ali-AliAli-Ali

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 02:20:14