sea-bass / pyrobosim

ROS 2 enabled 2D mobile robot simulator for behavior prototyping.
https://pyrobosim.readthedocs.io/
MIT License
248 stars 40 forks source link

Local install of Pyrobosim throws error "AttributeError processing template 'msg.idl.em'" during local install #283

Closed EdwardCalvert closed 1 month ago

EdwardCalvert commented 1 month ago

Hi, I am trying to run pyrobosim with the local install method. I've followed the documentation, and seem to get the same error message every time after installation, which I have included below. I was just wondering how to fix this error?

Cheers

Python version: Python 3.12.3

Ubuntu: Distributor ID: Ubuntu Description: Ubuntu 24.04.1 LTS Release: 24.04 Codename: noble

source ./setup/source_pyrobosim.bash Activated virtual environment at /home/ed/python-virtualenvs/pyrobosim. Setting up pyrobosim with ROS jazzy. Building ROS workspace at /home/ed/ros2_pyrobosim/... Starting >>> pyrobosim_msgs Starting >>> pyrobosim --- stderr: pyrobosim_msgs
CMake Error at /opt/ros/jazzy/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:57 (message): execute_process(/home/ed/python-virtualenvs/pyrobosim/bin/python3 -m rosidl_adapter --package-name pyrobosim_msgs --arguments-file /home/ed/ros2_pyrobosim/build/pyrobosim_msgs/rosidl_adapterargumentspyrobosim_msgs.json --output-dir /home/ed/ros2_pyrobosim/build/pyrobosim_msgs/rosidl_adapter/pyrobosim_msgs --output-file /home/ed/ros2_pyrobosim/build/pyrobosim_msgs/rosidl_adapter/pyrobosim_msgs.idls) returned error code 1:

AttributeError processing template 'msg.idl.em'

Traceback (most recent call last):

File "/opt/ros/jazzy/lib/python3.12/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.12/site-packages/rosidl_adapter/__main__.py", line 19, in <module>
  sys.exit(main())
           ^^^^^^
File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/main.py", line 53, in main
  abs_idl_file = convert_to_idl(
                 ^^^^^^^^^^^^^^^
File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/__init__.py", line 19, in convert_to_idl
  return convert_msg_to_idl(
         ^^^^^^^^^^^^^^^^^^^
File "/opt/ros/jazzy/lib/python3.12/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.12/site-packages/rosidl_adapter/resource/__init__.py", line 23, in expand_template
  content = evaluate_template(template_name, data)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/ros/jazzy/lib/python3.12/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:43 (rosidl_generate_interfaces)


Failed <<< pyrobosim_msgs [0.94s, exited with code 1] Aborted <<< pyrobosim [1.06s]

Summary: 0 packages finished [1.36s] 1 package failed: pyrobosim_msgs 1 package aborted: pyrobosim 1 package had stderr output: pyrobosim_msgs 1 package not processed Sourcing ROS workspace at /home/ed/ros2_pyrobosim/.

sea-bass commented 1 month ago

You may need to do something like this: https://stackoverflow.com/a/77656642

EdwardCalvert commented 1 month ago

Thank you very much! This solved my issue!