ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ModuleNotFoundError: No module named 'ament_package'

asked 2022-10-14 03:15:07 -0500

damiano gravatar image

updated 2022-10-15 10:53:38 -0500

ravijoshi gravatar image

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!

edit retag flag offensive close merge delete

Comments

Are you using environments like conda etc? Furthermore, can you please execute the following command and share the output: printenv | grep PYTHONPATH

ravijoshi gravatar image ravijoshi  ( 2022-10-15 10:58:02 -0500 )edit

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:

PYTHONPATH=/opt/ros/foxy/lib/python3.8/site-packages
damiano gravatar image damiano  ( 2022-10-16 21:39:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-17 03:54:12 -0500

damiano gravatar image

It looks like the problem was with anaconda indeed. I tried to redo everything from scratch, without activating any conda environment, and the error disappeared.

edit flag offensive delete link more

Comments

I am glad you made it work. Better to disable conda while working with ROS. It seems they don't like each other :D

ravijoshi gravatar image ravijoshi  ( 2022-10-17 04:45:17 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-14 03:15:07 -0500

Seen: 519 times

Last updated: Oct 17 '22