You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
conda create -n ros2env python=3.8
conda activate ros2env
# this adds the conda-forge channel to your persistent configuration in ~/.condarc
conda config --env --add channels conda-forge
# and the robostack channel
conda config --env --add channels robostack
# it's very much advised to use strict channel priority
conda config --env --set channel_priority strict
mamba install ros-foxy-base
mamba install compilers cmake pkg-config colcon-common-extensions
conda deactivate
conda activate ros2env
Build command
git clone https://github.com/robotology-playground/yarp-ros2
cd yarp-ros2/ros2_interfaces_ws
colcon build --packages-select map2d_nws_ros2_msgs
Build error
(ros2env) traversaro@IITICUBLAP102:~/yarp-ros2/ros2_interfaces_ws$ colcon build --packages-select map2d_nws_ros2_msgs
Starting >>> map2d_nws_ros2_msgs
--- stderr: map2d_nws_ros2_msgs
Traceback (most recent call last):
File "/home/traversaro/mambaforge/envs/ros2env/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py", line 21, in <module>
from ament_package.templates import get_environment_hook_template_path
ModuleNotFoundError: No module named 'ament_package'
CMake Error at /home/traversaro/mambaforge/envs/ros2env/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
execute_process(/home/traversaro/mambaforge/bin/python3
/home/traversaro/mambaforge/envs/ros2env/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
/home/traversaro/yarp-ros2/ros2_interfaces_ws/build/map2d_nws_ros2_msgs/ament_cmake_package_templates/templates.cmake) returned error code 1
Call Stack (most recent call first):
/home/traversaro/mambaforge/envs/ros2env/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:41 (include)
/home/traversaro/mambaforge/envs/ros2env/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
/home/traversaro/mambaforge/envs/ros2env/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
CMakeLists.txt:19 (find_package)
---
Failed <<< map2d_nws_ros2_msgs [0.08s, exited with code 1]
Summary: 0 packages finished [0.24s]
1 package failed: map2d_nws_ros2_msgs
1 package had stderr output: map2d_nws_ros2_msgs
Notes
Note that ros-foxy-ament-package is correctly installed, and if I open a python interpreter and run from ament_package.templates import get_environment_hook_template_path it works fine, so probably the issue is that a new Python interpreter that is not correctly configured is launched, or something similar.
Indeed it looks like it chooses the wrong python interpreter:
execute_process(/home/traversaro/mambaforge/bin/python3
/home/traversaro/mambaforge/envs/ros2env/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
/home/traversaro/yarp-ros2/ros2_interfaces_ws/build/map2d_nws_ros2_msgs/ament_cmake_package_templates/templates.cmake) returned error code 1
It should read execute_process(/home/traversaro/mambaforge/envs/ros2env/bin/python3 and not mambaforge/bin/python3.
Will have to investigate why this happens. Maybe if you can supply extra-cmake args to colcon a hotfix would be to give the absolute path the python interpreter ($CONDA_PREFIX/bin/python with activated ros2env).
I wanted to start testing the ROS2 packages by building a simple package (from https://github.com/robotology-playground/yarp-ros2), but compilation is failing.
Installation process
Build command
Build error
Notes
Note that
ros-foxy-ament-package
is correctly installed, and if I open a python interpreter and runfrom ament_package.templates import get_environment_hook_template_path
it works fine, so probably the issue is that a new Python interpreter that is not correctly configured is launched, or something similar.Complete environment
The text was updated successfully, but these errors were encountered: