Robotics StackExchange | Archived questions

ROS2 humble build error on fedora 37: exception in shell extension 'sh': The environment shouldn't be empty

Hello,

I am posting here after trying almost all the method (I even asked chatGPT for the solution and it couldn't help !). I am trying to install ROS2 humble on Fedora 37, I followed every steps on the documentation website, but when it comes to building ROS using this command :

colcon build --symlink-install --cmake-args -DTHIRDPARTY_Asio=ON --no-warn-unused-cli

I get this output message :

Starting >>> ament_package
Starting >>> ament_lint
Starting >>> gtest_vendor
Starting >>> fastcdr
[4.998s] colcon.colcon_core.shell ERROR Exception in shell extension 'sh': The environment shouldn't be empty
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/__init__.py", line 298, in get_command_environment
    return await extension.generate_command_environment(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/sh.py", line 147, in generate_command_environment
    env = await get_environment_variables(cmd, cwd=str(build_base))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/__init__.py", line 364, in get_environment_variables
    assert len(env) > 0, "The environment shouldn't be empty"
AssertionError: The environment shouldn't be empty

[4.999s] colcon.colcon_ros.task.ament_python.build ERROR Could not find a shell extension for the command environment
[5.000s] colcon.colcon_core.shell ERROR Exception in shell extension 'sh': The environment shouldn't be empty
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/__init__.py", line 298, in get_command_environment
    return await extension.generate_command_environment(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/sh.py", line 147, in generate_command_environment
    env = await get_environment_variables(cmd, cwd=str(build_base))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/__init__.py", line 364, in get_environment_variables
    assert len(env) > 0, "The environment shouldn't be empty"
AssertionError: The environment shouldn't be empty

Failed   <<< ament_package [0.09s, exited with code 1]
[5.000s] colcon.colcon_ros.task.ament_python.build ERROR Could not find a shell extension for the command environment
[5.001s] colcon.colcon_core.shell ERROR Exception in shell extension 'sh': The environment shouldn't be empty
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/__init__.py", line 298, in get_command_environment
    return await extension.generate_command_environment(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/sh.py", line 147, in generate_command_environment
    env = await get_environment_variables(cmd, cwd=str(build_base))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/colcon_core/shell/__init__.py", line 364, in get_environment_variables
    assert len(env) > 0, "The environment shouldn't be empty"
AssertionError: The environment shouldn't be empty

Failed   <<< ament_lint [0.08s, exited with code 1]
[5.002s] colcon.colcon_cmake.task.cmake.build ERROR Could not find a shell extension for the command environment
Aborted  <<< fastcdr [0.03s]
Aborted  <<< gtest_vendor [0.05s]

Summary: 0 packages finished [4.35s]
  2 packages failed: ament_lint ament_package
  2 packages aborted: fastcdr gtest_vendor
  339 packages not processed

After reading the code of colcon core many times, I think the issue is that it can't read the environment variables, or something like that. I tried to reinstall everything and nothing changes. Did anyone experience such thing ?

Thanks in advance.

Asked by mouad on 2023-01-17 22:14:15 UTC

Comments

Answers

Could be colcon/colcon-core#545.

According to that:

I was finally able to reproduce this. The regression is caused by python3.11-3.11.1-1.fc37. You can dnf downgrade python3.11 for now as a workaround.

but see the issue for more information/comments.

Asked by gvdhoorn on 2023-01-18 03:42:03 UTC

Comments

Your solution works. Thanks !

Asked by mouad on 2023-01-19 06:31:56 UTC

Well, it's not really a solution. More of a work-around. But ok.

Asked by gvdhoorn on 2023-01-19 12:43:19 UTC