colcon build failures windows- beginner
I'm going thorugh the beginners tutorials but I've run into problem building packages with colcon
. I searched for similar questions but no joy.
I'm running as admin from a VS 2019 command line, I sourced ros2
by running the local_setup.bat
file
Win10 x64, ROS 2 - Humble, VS 2019
--- 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)
you appear to have Anaconda installed, which is an alternative Python interpreter.
The ROS 2 for Windows distributions will not work with it, as the required Python dependencies (such as
catkin_pkg
) are only installed for the Python interpreter ROS 2 was build for/with.So I have to uninstall Anaconda to use ROS2? That seems kinda drastic
No. You need to make sure the terminal/
cmd
window you run Colcon in has it'sPATH
updated such that it can't find (or "see") Anaconda. That is all.Ahh OK, how do I do that?
Provided you've not built ROS 2 from source using Anaconda (in that case I would not expect the issue you report), you could use a procedure like this one (NOTE: just a random link to a page describing how to edit the
PATH
under Windows 10). Allcmd
windows started after making the change(s) would have the updatedPATH
.You probably don't even need to remove Anaconda from the
PATH
. Making the entry for Anaconda inPATH
point to an invalid path should already work.Do I add a new path entry to point
colcon
to ROS's own version of Python or is it just enough to stop it pointing at Conda?