ros-tooling/setup-ros

Calling colcon fails on Windows

Opened this issue · 5 comments

Description

Colcon build fails on Humble/Windows because catkin_pkg can not be found.

Expected Behavior

After setting up Humble and sourcing the setup script calling colcon build should not fail.

Actual Behavior

Since the Python version for Windows is hard coded the setup and colcon use different Python versions which leads to colcon complaining about missing packages.

System

  • OS: Windows 2019
  • ROS 2 Distro: Humble

Additional context

Workflow
Logs
Similar Issue

I tried using ros-tooling/action-ros-ci to handle the building and testing since its is often used with this action but the error remains:

Workflow
Logs

Looking at the workflow logs, it looks like the ament_cmake_export_assemblies package (from https://github.com/ros2-dotnet/ament_cmake_export_assemblies) depends on catkin_pkg. Usually, rosdep would install all packages' dependencies, but it doesn't support Windows, so you need to install it (or build it) yourself.

The log says that catkin_pkg is being installed by pip since colcon-ros depends on it.
I think the problem is that colcon selects Python version 3.11, which is not the version used during setup and therefore does not contain the installed packages.
Do you know a way of forcing colcon to use a particular Python version, using -DPYTHON_EXECUTABLE=... as extra CMake arg did not work.

I'm not sure. Perhaps there's a workflow-/job-level environment variable you can set to select the Python version? See https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow

Windows support here (setup-ros and action-ros-ci) isn't great. Any PRs to improve it would be appreciated.

I found the cause with help from answers.ros.org and fixed the problem by instructing CMake to not try to find a higher Python version than the one specified with Python3_ROOT_DIR=... with the -DPython3_FIND_STRATEGY=LOCATION CMake arg.
Furthermore I had to create a junction C:\Python38 since it seemed hardcoded in some packages.
I dont know if I can make a PR since I made the changes using a custom build script and dont have any experience with Github Actions and Typescript development.