ModuleNotFoundError: No module named 'ament_package'
Hello,
I'm new to ROS, after reading a bit of documentation, I'm trying to install tentone/tello-ros2 repository to run orbslam on a tello drone. I am using ROS Foxy.
The dependencies are correctly installed after running scripts/install.sh
. When I run the script scripts/build.sh
however, which is basically running 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
In other threads in this forum it was suggested to source the setup file to set up environment, which I already did (source /opt/ros/foxy/setup.bash
), but that didn't help.
The strange thing is, if I open python (/usr/bin/python3
) and I run the command:
from ament_package.templates import get_environment_hook_template_path
it works perfectly fine, with no error.
I am totally stuck and with no clue, so I'm asking here - anyone has any idea what I am doing wrong? as I said I'm quite new to ROS, so I suspect I am missing something very basic here. Thanks for the help!
Are you using environments like
conda
etc? Furthermore, can you please execute the following command and share the output:printenv | grep PYTHONPATH
Hi, I have tried both using anaconda environment or no environment at all, but I get the error anyways. Without activating conda environment, this is the output of the command: