ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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

asked 2023-01-17 21:14:15 -0500

mouad gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-01-18 02:42:03 -0500

gvdhoorn gravatar image

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.

edit flag offensive delete link more

Comments

Your solution works. Thanks !

mouad gravatar image mouad  ( 2023-01-19 05:31:56 -0500 )edit

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

gvdhoorn gravatar image gvdhoorn  ( 2023-01-19 11:43:19 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2023-01-17 21:14:15 -0500

Seen: 424 times

Last updated: Jan 17 '23