Robotics StackExchange | Archived questions

ModuleNotFoundError: No module named 'catkin_pkg' problem when building a new package

I'm trying to do the tutorial from the https://www.youtube.com/watch?v=T4iRJqESQAk tutorial. When I'm trying to build the package, I receive the following error code:

--- stderr: my_packate                         
Traceback (most recent call last):
  File "/home/pablo/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/pablo/ros2_foxy/install/ament_cmake_core/share/ament_cmake_core/cmake

/core/ament_package_xml.cmake:94 (message):
  execute_process(/home/pablo/anaconda3/bin/python3
  /home/pablo/ros2_foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
  /home/pablo/ros_tutorials/construct/src/my_packate/package.xml
  /home/pablo/ros_tutorials/construct/build/my_packate/ament_cmake_core/package.cmake)
  returned error code 1
Call Stack (most recent call first):
  /home/pablo/ros2_foxy/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
  /home/pablo/ros2_foxy/install/ament_lint_auto/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml)
  CMakeLists.txt:30 (ament_lint_auto_find_test_dependencies)

I've done some modifications to the CMakeList.text file, such as uncommenting the line that said set(amentcmakecpplint_FOUND TRUE), but it didn't solve the problem.

I tried what I saw of installing the python3-catking-pkg, but it is already installed.

Asked by pablo.arandarod on 2021-03-15 16:33:21 UTC

Comments

Just try this line in place of python3:

sudo apt-get install python-catkin-pkg

Reason: This allows to install python-catkin-pkg-modules and python3-catkin-pkg-modules at the same time.

Asked by Ranjit Kathiriya on 2021-03-16 07:44:15 UTC

@Ranjit I tried, but it didn't work.

In any way, I downloaded the file from the tutorial and it seemed to work.

Asked by pablo.arandarod on 2021-03-16 17:15:30 UTC

Answers