ModuleNotFoundError: No module named 'ament_package' [closed]
Hello,
I am new to ROS. After reading a bit of documentation, I am trying to install the following repo: https://github.com/tentone/tello-ros2 In order to control a tello drone and use orbslam on it. As a reference, I am using foxy distro on ubuntu 20.04, with pyton3.8.
The installation of the dependencies (script/install.sh) works fine. But when I try to build the packages using script/build.sh, which basically runs colcon:
colcon build --symlink-install --packages-select tello tello_control tello_msg
I keep getting the following error:
WARNING: ROS_PYTHON_VERSION is unset. Defaulting to 3
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
tello: Cannot locate rosdep definition for [rosidl_default_runtime]
tello_control: Cannot locate rosdep definition for [ament_lint_common]
tello_msg: Cannot locate rosdep definition for [ament_lint_common]
Starting >>> tello_msg
Starting >>> tello_control
--- stderr: tello_msg
Traceback (most recent call last):
File "/opt/ros/foxy/share/ament_cmake_core/cmake//package_templates/templates_2_cmake.py", line 20, in <module>
from ament_package.templates import get_environment_hook_template_path
ModuleNotFoundError: No module named 'ament_package'
CMake Error at /opt/ros/foxy/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
execute_process(/usr/bin/python3
/opt/ros/foxy/share/ament_cmake_core/cmake//package_templates/templates_2_cmake.py
/home/huangpan1/tello_1410/tello-ros2/workspace/build/tello_msg/ament_cmake_package_templates/templates.cmake)
returned error code 1
Call Stack (most recent call first):
/opt/ros/foxy/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:41 (include)
/opt/ros/foxy/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
/opt/ros/foxy/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
CMakeLists.txt:18 (find_package)
---
Failed <<< tello_msg [0.82s, exited with code 1]
Aborted <<< tello_control [0.81s]
Summary: 0 packages finished [0.96s]
1 package failed: tello_msg
1 package aborted: tello_control
2 packages had stderr output: tello_control tello_msg
1 package not processed
From similar threads in this forum, it was suggested to source the setup file to set up the environment first, which I did (source /opt/ros/foxy/setup.bash), so the solution is somewhere else.
The thing that I also don't understand is, if I open python (/usr/bin/python3) and I run the exact command:
from ament_package.templates import get_environment_hook_template_path
it works perfectly fine, and doesn't give any error.
As I said I am quite new to ros, so I may be missing something very obvious here - any help would be appreciated, since I have been stuck for a few days now. Thanks!