micro-ROS / micro_ros_setup

Support macros for building micro-ROS-based firmware.
Apache License 2.0
381 stars 137 forks source link

Create firmware step failed for freertos and olimex-stm32-e407 #571

Closed ravi-nanjaiah closed 2 years ago

ravi-nanjaiah commented 2 years ago

Issue template

Steps to reproduce the issue

I'm trying to follow the tutorials to build a demo application as per instructions in https://micro.ros.org/docs/tutorials/core/first_application_rtos/freertos/

  1. install ROS2 Foxy as per instructions in https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html
  2. Install micro_ros_setup build system as per instructions
  3. Follow the create firmware step: ros2 run micro_ros_setup create_firmware_ws.sh freertos olimex-stm32-e407

Expected behavior

Firmware preparation is complete and progress to configure application step

Actual behavior

Create firmware step fails with following error ImportError: cannot import name 'environmentfilter' from 'jinja2' (/home/nrr2kor/.local/lib/python3.8/site-packages/jinja2/__init__.py)

Additional information

Through out the create firmware step the above error message is multiple times.

'$ ros2 run micro_ros_setup create_firmware_ws.sh freertos olimex-stm32-e407
Creating firmware for freertos platform olimex-stm32-e407
.......
=== ./ament/ament_cmake (git) ===
Cloning into '.'...
=== ./ament/ament_index (git) ===
Cloning into '.'...
=== ./ament/ament_lint (git) ===
Cloning into '.'...
=== ./ament/ament_package (git) ===
Cloning into '.'...
=== ./ament/googletest (git) ===
Cloning into '.'...
=== ./ament/uncrustify_vendor (git) ===
Cloning into '.'...
=== ./ros2/ament_cmake_ros (git) ===
Cloning into '.'...
List of repositories is empty
#All required rosdeps installed successfully
..............
=== ./ros2/common_interfaces (git) ===
Cloning into '.'...
=== ./ros2/example_interfaces (git) ===
Cloning into '.'...
=== ./ros2/libyaml_vendor (git) ===
Cloning into '.'...
=== ./ros2/rcl (git) ===
Cloning into '.'...
=== ./ros2/rcl_interfaces (git) ===
Cloning into '.'...
=== ./ros2/rcl_logging (git) ===
Cloning into '.'...
=== ./ros2/rcpputils (git) ===
Cloning into '.'...
=== ./ros2/rmw (git) ===
Cloning into '.'...
=== ./ros2/rmw_implementation (git) ===
Cloning into '.'...
=== ./ros2/rosidl (git) ===
Cloning into '.'...
=== ./ros2/rosidl_dds (git) ===
Cloning into '.'...
=== ./ros2/rosidl_defaults (git) ===
Cloning into '.'...
=== ./ros2/test_interface_files (git) ===
Cloning into '.'...
=== ./ros2/unique_identifier_msgs (git) ===
Cloning into '.'...
...........
=== ./eProsima/Micro-CDR (git) ===
Cloning into '.'...
=== ./eProsima/Micro-XRCE-DDS-Client (git) ===
Cloning into '.'...
=== ./ros2/tinydir_vendor (git) ===
Cloning into '.'...
=== ./uros/micro_ros_msgs (git) ===
Cloning into '.'...
=== ./uros/rcl (git) ===
Cloning into '.'...
=== ./uros/rclc (git) ===
Cloning into '.'...
=== ./uros/rcutils (git) ===
Cloning into '.'...
=== ./uros/rmw_microxrcedds (git) ===
Cloning into '.'...
=== ./uros/rosidl_typesupport (git) ===
Cloning into '.'...
=== ./uros/rosidl_typesupport_microxrcedds (git) ===
Cloning into '.'...
=== ./uros/tracetools (git) ===
Cloning into '.'...
warning: redirecting to https://gitlab.com/micro-ROS/ros_tracing/ros2_tracing.git/
Crosscompiled environment: cleaning path
Starting >>> ament_package
Starting >>> ament_lint
Starting >>> gtest_vendor
Starting >>> ament_cppcheck
Starting >>> ament_pycodestyle
Finished <<< gtest_vendor [1.30s]                            
Starting >>> gmock_vendor
Finished <<< gmock_vendor [0.16s]                            
--- stderr: ament_cppcheck                                   
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/colcon_core/executor/__init__.py", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/colcon_core/task/__init__.py", line 93, in __call__
    return await task_method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 105, in build
    return await extension.build(additional_hooks=additional_hooks)
  File "/usr/lib/python3/dist-packages/colcon_core/task/python/build.py", line 59, in build
    available_commands = await self._get_available_commands(
  File "/usr/lib/python3/dist-packages/colcon_core/task/python/build.py", line 142, in _get_available_commands
    output = await check_output(
  File "/usr/lib/python3/dist-packages/colcon_core/subprocess.py", line 128, in check_output
    assert not rc, f'Expected {args} to pass: {stderr_data}'
AssertionError: Expected ['/usr/bin/python3', 'setup.py', '--help-commands'] to pass: Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    setup(
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 172, in setup
    ok = dist.parse_command_line()
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 476, in parse_command_line
    if self.handle_display_options(option_order):
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/dist.py", line 1185, in handle_display_options
    return _Distribution.handle_display_options(self, option_order)
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 690, in handle_display_options
    self.print_commands()
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/dist.py", line 962, in print_commands
    cmdclass = ep.load()
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/setup_command.py", line 20, in <module>
    from sphinx.application import Sphinx
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/application.py", line 43, in <module>
    from sphinx.registry import SphinxComponentRegistry
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/registry.py", line 24, in <module>
    from sphinx.builders import Builder
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 26, in <module>
    from sphinx.util import import_object, logging, progress_message, rst, status_iterator
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/util/rst.py", line 21, in <module>
    from jinja2 import Environment, environmentfilter
ImportError: cannot import name 'environmentfilter' from 'jinja2' (/home/nrr2kor/.local/lib/python3.8/site-packages/jinja2/__init__.py)

---
Failed   <<< ament_cppcheck [1.87s, exited with code 1]
Aborted  <<< ament_package [1.92s]                                      
Aborted  <<< ament_pycodestyle [1.89s]
Aborted  <<< ament_lint [1.92s]

Summary: 2 packages finished [2.25s]
  1 package failed: ament_cppcheck
  3 packages aborted: ament_lint ament_package ament_pycodestyle
  1 package had stderr output: ament_cppcheck
  54 packages not processed
Expected ['/usr/bin/python3', 'setup.py', '--help-commands'] to pass: Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    setup(
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 172, in setup
    ok = dist.parse_command_line()
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 476, in parse_command_line
    if self.handle_display_options(option_order):
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/dist.py", line 1185, in handle_display_options
    return _Distribution.handle_display_options(self, option_order)
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 690, in handle_display_options
    self.print_commands()
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/dist.py", line 962, in print_commands
    cmdclass = ep.load()
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/setup_command.py", line 20, in <module>
    from sphinx.application import Sphinx
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/application.py", line 43, in <module>
    from sphinx.registry import SphinxComponentRegistry
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/registry.py", line 24, in <module>
    from sphinx.builders import Builder
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 26, in <module>
    from sphinx.util import import_object, logging, progress_message, rst, status_iterator
  File "/home/nrr2kor/.local/lib/python3.8/site-packages/sphinx/util/rst.py", line 21, in <module>
    from jinja2 import Environment, environmentfilter
ImportError: cannot import name 'environmentfilter' from 'jinja2' (/home/nrr2kor/.local/lib/python3.8/site-packages/jinja2/__init__.py)
'
Acuadros95 commented 2 years ago

Could not replicate this on a fresh docker.

What is your output for pip3 list | grep Jinja2? Could you try again after downgrading Jinja2 version with pip3 install jinja2==3.0.0?

Related: https://github.com/readthedocs/readthedocs.org/issues/9038

ravi-nanjaiah commented 2 years ago

Thanks @Acuadros95 Downgrading Jinja2 version worked. Build was completed post downgrade. Downgrading had to be done post the configure firmware step.