Robotics StackExchange | Archived questions

ModuleNotFoundError: No module named 'ament_package'

Hi,

I am getting the following error when I am trying colcon build, I tried almost all suggested solutions and none of them working for me. can you please help me? I source my environment. I tried both ros2 foxy and ros2 galactic, same error.

sudo colcon build --install-base=/opt/performancetest --merge-install --cmake-clean-cache --cmake-args -DCMAKEPREFIXPATH=/opt/ros/ Starting >>> performancetest --- stderr: performancetest Traceback (most recent call last):
File "/opt/ros/ament
cmakecore/share/amentcmakecore/cmake/packagetemplates/templates2cmake.py", line 21, in from amentpackage.templates import getenvironmenthooktemplatepath ModuleNotFoundError: No module named 'amentpackage' CMake Error at /opt/ros/amentcmakecore/share/amentcmakecore/cmake/amentcmakepackagetemplates-extras.cmake:41 (message):
execute
process(/usr/bin/python3
/opt/ros/amentcmakecore/share/amentcmakecore/cmake/packagetemplates/templates2cmake.py /home/ubuntu/perftestws/build/performancetest/amentcmakepackagetemplates/templates.cmake) returned error code 1 Call Stack (most recent call first):
/opt/ros/ament
cmakecore/share/amentcmakecore/cmake/amentcmakecoreConfig.cmake:41 (include)
/opt/ros/ament
cmake/share/amentcmake/cmake/amentcmakeexportdependencies-extras.cmake:15 (findpackage)
/opt/ros/ament
cmake/share/amentcmake/cmake/amentcmakeConfig.cmake:41 (include) CMakeLists.txt:27 (find_package)

Thank you

Asked by Ellie on 2022-06-07 12:37:47 UTC

Comments

I have exactly the same issue, and I am still stuck

Asked by Fahima Mokhtari on 2022-10-18 05:23:57 UTC

Answers

Run colcon without sudo:

$colcon build ...

Asked by Andromeda on 2023-07-08 14:11:40 UTC

Comments