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

asked 2021-03-15 16:33:21 -0500

pablo.arandarod gravatar image

I'm trying to do the tutorial from the https://www.youtube.com/watch?v=T4iRJ... 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(ament_cmake_cpplint_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.

edit retag flag offensive close merge delete

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.

Ranjit gravatar image Ranjit  ( 2021-03-16 07:44:15 -0500 )edit

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

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

pablo.arandarod gravatar image pablo.arandarod  ( 2021-03-16 17:15:30 -0500 )edit