how to resolve ModuleNotFoundError: No module named 'catkin_pkg'

asked 2022-11-15 12:26:53 -0500

rao gravatar image

updated 2022-11-17 09:27:29 -0500

Ranjit Kathiriya gravatar image

Hi All,

I am new to ROS and could some one please share some inputs with me to resolve this issue.

  1. I am seeing "ModuleNotFoundError: No module named 'catkin_pkg'" error when I have recreated the my own package. Does it mean that we should run "ros2 pkg create –build-type ament_python –node-name my_node <package>" twice in the same workspace?

  2. I am trying to run "colcon build" in a new workspace and I am seeing below error. please provide some tips on how to resolve this issue.

Starting >>> rviz2 --- stderr: rviz2 Traceback (most recent call last):
File "/home/niranjan/ros2_foxy/install/ament_cmake_core/share/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 /home/niranjan/ros2_foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:94 (message):
execute_process(/home/niranjan/colcon_venv/venv/bin/python3 /home/niranjan/ros2_foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py /home/niranjan/ros2_foxy/src/ros2/rviz/rviz2/package.xml /home/niranjan/ros2_foxy/build/rviz2/ament_cmake_core/package.cmake) returned error code 1 Call Stack (most recent call first):
/home/niranjan/ros2_foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
/home/niranjan/ros2_foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_package.cmake:63 (ament_package_xml)
CMakeLists.txt:101 (ament_package)

Failed <<< rviz2 [12.7s, exited with code 1]

Aborted <<< ros1_bridge [27min 2s]

Thanks

edit retag flag offensive close merge delete

Comments

1

ros2 : If you are using ROS2 then you havee to use colcon build.

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2022-11-17 09:29:50 -0500 )edit