Colcon build fails for ament_cmake_core
System: Ubuntu 20.04.3 (64)
I have been trying to run the colcon build--symlink-install command and every time I run it I get the error: No module named 'catkin_pkg' and it fails on ament_cmake_core. I have installed the package using sudo apt install python3-catkin-pkg and it still throws me the same error. Not sure how to fix this or why it is throwing the same error when it is installed. I have attached the full log below:
(base) jehan@jehan-VirtualBox:~/ros2_foxy$ colcon build --symlink-install
Starting >>> ament_package
Finished <<< ament_package [0.39s]
Starting >>> ament_cmake_core
--- stderr: ament_cmake_core
Traceback (most recent call last):
File "/home/jehan/ros2_foxy/src/ament/ament_cmake/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 21, in <module>
from catkin_pkg.package import parse_package_string
ModuleNotFoundError: No module named 'catkin_pkg'
CMake Error at cmake/core/ament_package_xml.cmake:94 (message):
execute_process(/home/jehan/anaconda3/bin/python3
/home/jehan/ros2_foxy/src/ament/ament_cmake/ament_cmake_core/cmake/core/package_xml_2_cmake.py
/home/jehan/ros2_foxy/src/ament/ament_cmake/ament_cmake_core/package.xml
/home/jehan/ros2_foxy/build/ament_cmake_core/ament_cmake_core/package.cmake)
returned error code 1
Call Stack (most recent call first):
cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
CMakeLists.txt:15 (ament_package_xml)
---
Failed <<< ament_cmake_core [0.09s, exited with code 1]
Summary: 1 package finished [1.71s]
1 package failed: ament_cmake_core
1 package had stderr output: ament_cmake_core
308 packages not processed