DrBwts
DrBwts

Reputation: 3657

ROS2 colcon build failure

Win10 x64, ROS 2 - Humble, VS 2019

I'm going through the ROS beginners tutorials but I've run into problem building packages with colcon and got as far as the Using colcon to build packages tutorial.

I'm running as admin from a VS 2019 command line, I sourced ros2 by running the local_setup.bat file. I installed the colcon extensions, downloaded the examples & set up the directory structure as outlined in the tutorial.

I then tried to build colcon using colcon build --symlink-install --merge-install

Which after installing a few packages complains & aborts the build with,

--- stderr: examples_rclcpp_minimal_publisher
Traceback (most recent call last):
  File "C:\ROS_Humble\ros2\share\ament_cmake_core\cmake\core\package_xml_2_cmake.py", line 22, in <module>
    from catkin_pkg.package import parse_package_string
ModuleNotFoundError: No module named 'catkin_pkg'
CMake Error at C:/ROS_Humble/ros2/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
  execute_process(C:/ProgramData/Anaconda3/python.exe
  C:/ROS_Humble/ros2/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
  D:/ROS_scratch/dev/ros2_ws/src/examples/rclcpp/topics/minimal_publisher/package.xml
  D:/ROS_scratch/build/examples_rclcpp_minimal_publisher/ament_cmake_core/package.cmake)
  returned error code 1
Call Stack (most recent call first):
  C:/ROS_Humble/ros2/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
  C:/ROS_Humble/ros2/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml)
  CMakeLists.txt:47 (ament_lint_auto_find_test_dependencies)

Anyone know what this is about? I've seen a few posts around about people not sourcing ros2 in the right environment but that isn't the issue here.

Upvotes: 2

Views: 7315

Answers (3)

diytechy
diytechy

Reputation: 23

As a potential answer, for me, this issue was due to a second python installation through the Windows store that was not visible in the normal programs and applications list. After using the "newer" "Add or Remove Programs" option from Windows, I was able to find the other python installation, remove it, and was able to build.

Upvotes: 1

Alesof
Alesof

Reputation: 341

If you are using a local env with anaconda you should try installing the following dependencies:

conda install -c conda-forge catkin_pkg empy lark

Upvotes: 0

Milan Š.
Milan Š.

Reputation: 1638

I would start by trying to obtain the catkin_pkg module and making sure it's installed, based on:

ModuleNotFoundError: No module named 'catkin_pkg'

Apparently this should do the trick: pip install -U catkin_pkg


If that doesn't help then I will update my answer with hints on how to debug this to get more information for us.

Upvotes: 0

Related Questions