Robotics StackExchange | Archived questions

Issue with Humble tutorial creating a workspace when running colcon build

I am going through humble tutorial on creating a workspace. At step 5: build a workspace with colcon, I encounter an error after running colcon build --merge-install command.

C:\ros2_ws\src>colcon build --merge-install
Starting >>> turtlesim
--- stderr: turtlesim
CMake Error at C:/dev/ros2_humble/ros2-windows/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
  execute_process(C:/Users/Otto/anaconda3/python.exe -m rosidl_adapter
  --package-name turtlesim --arguments-file
  C:/ros2_ws/src/build/turtlesim/rosidl_adapter__arguments__turtlesim.json
  --output-dir C:/ros2_ws/src/build/turtlesim/rosidl_adapter/turtlesim
  --output-file C:/ros2_ws/src/build/turtlesim/rosidl_adapter/turtlesim.idls)
  returned error code 1:

  Traceback (most recent call last):

    File "C:\Users\Otto\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "C:\Users\Otto\anaconda3\lib\runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "C:\dev\ros2_humble\ros2-windows\Lib\site-packages\rosidl_adapter\__main__.py", line 19, in <module>
      sys.exit(main())
    File "C:\dev\ros2_humble\ros2-windows\Lib\site-packages\rosidl_adapter\main.py", line 53, in main
      abs_idl_file = convert_to_idl(
    File "C:\dev\ros2_humble\ros2-windows\Lib\site-packages\rosidl_adapter\__init__.py", line 28, in convert_to_idl
      from rosidl_adapter.action import convert_action_to_idl
    File "C:\dev\ros2_humble\ros2-windows\Lib\site-packages\rosidl_adapter\action\__init__.py", line 16, in <module>
      from rosidl_adapter.resource import expand_template
    File "C:\dev\ros2_humble\ros2-windows\Lib\site-packages\rosidl_adapter\resource\__init__.py", line 19, in <module>
      import em

  ModuleNotFoundError: No module named 'em'

Call Stack (most recent call first):
  C:/dev/ros2_humble/ros2-windows/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
  CMakeLists.txt:24 (rosidl_generate_interfaces)


---
Failed   <<< turtlesim [2.08s, exited with code 1]

Summary: 0 packages finished [2.33s]
  1 package failed: turtlesim
  1 package had stderr output: turtlesim

So after this error I install the missing module em using pip install em and receive another error after running colcon build --merge-install again

colcon.colcon_core.entry_point ERROR Exception loading extension 'colcon_core.environment_variable.powershell_command': cannot import name 'Interpreter' from 'em' (c:\python38\lib\site-packages\em\__init__.py) The Python package 'empy' must be installed and 'em' must not be installed since both packages share the same namespace
Traceback (most recent call last):
  File "c:\python38\lib\site-packages\colcon_core\entry_point.py", line 120, in load_entry_points
    extension_type = load_entry_point(entry_point)
  File "c:\python38\lib\site-packages\colcon_core\entry_point.py", line 166, in load_entry_point
    return entry_point.load()
  File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 2465, in load
    return self.resolve()
  File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 2471, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\python38\lib\site-packages\colcon_powershell\shell\powershell.py", line 17, in <module>
    from colcon_core.shell.template import expand_template
  File "c:\python38\lib\site-packages\colcon_core\shell\template\__init__.py", line 19, in <module>
    raise e from None
  File "c:\python38\lib\site-packages\colcon_core\shell\template\__init__.py", line 9, in <module>
    from em import Interpreter
ImportError: cannot import name 'Interpreter' from 'em' (c:\python38\lib\site-packages\em\__init__.py) The Python package 'empy' must be installed and 'em' must not be installed since both packages share the same namespace

So my question is how do you resolve the issue of these packages sharing the same namespace?

At this point I cannot create a workspace as both the empy and em packages are needed but they conflict with one another.

Asked by ottomusprime on 2022-09-20 13:52:32 UTC

Comments

this may help #q257331

Asked by ravijoshi on 2022-09-21 01:40:13 UTC

I've seen this post and tried the solutions but they haven't worked.

Asked by ottomusprime on 2022-09-21 16:10:18 UTC

Answers