Closed PeterS-mBryonics closed 5 months ago
Hi @PeterS-mBryonics, have you tried the trick at the bottom of https://robostack.github.io/FAQ.html? This should work - if not, feel free to reopen.
Best, Tobi
Heya, thanks, I gave that a go and it's still returning the same error:
CMake Error at /home/peter/mambaforge/envs/ros/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found version "3.11.4") Call Stack (most recent call first): /home/peter/mambaforge/envs/ros/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /home/peter/mambaforge/envs/ros/share/cmake-3.26/Modules/FindPython/Support.cmake:3766 (find_package_handle_standard_args) /home/peter/mambaforge/envs/ros/share/cmake-3.26/Modules/FindPython3.cmake:551 (include) /home/peter/mambaforge/envs/ros/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:24 (find_package) /home/peter/mambaforge/envs/ros/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include) /home/peter/mambaforge/envs/ros/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions) CMakeLists.txt:29 (rosidl_generate_interfaces)
It finds the wrong Python; could you please create a new environment without pip uninstalling numpy, delete all build/devel files in the colcon workspace, and try again?
Ta, tried it, same issue with a plain "colcon build" and with "colcon build --cmake-args "-DPython_EXECUTABLE=$CONDA_PREFIX/bin/python -DPython3_EXECUTABLE=$CONDA_PREFIX/bin/python -DPYTHON_EXECUTABLE=$CONDA_PREFIX/bin/python"" (deleted build and install both times)
I'm sorry to hear that it still does not work. I recommend avoiding the outdated FindPython3.cmake and instead using the newer FindPython.cmake that has much better support for conda. Switching is very easy, simply replacing find_package(Python3 ...)
with find_package(Python ...)
and then replacing e.g. Python3_INCLUDE_DIRS
with Python_INCLUDE_DIRS
and so forth.
Thanks, I'll give that a go. If I'm understanding the traceback correctly that tweak should be made in: mambaforge\envs\ros\share\rosidl_generator_py\cmake\rosidl_generator_py_generate_interfaces.cmake ?
Ah, now I realise that it’s not in your user code but in some ROS2 package. That’s very weird!
Could you please provide a minimum working example to replicate this issue? Then I can take a look. Please also run conda env export > environment.yml
and share the output so I can replicate your environment 1:1.
Thanks, Tobi
ros2_ws.zip ros_test_yml.zip No worries, see attached. I followed the https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.html tutorial to create a c++ package to test building, and https://robostack.github.io/GettingStarted.html to create the environment (including adding the build tools)
Also it all works fine on a WSL2 Ubuntu which is 22.04.3 LTS, but not on a native Ubuntu 23.04. I updated all the packages today to latest to make sure everything matched between the two environments as far as is possible.
That's very weird. I don't have an Ubuntu 23.04 installation around, so it's hard for me to debug. In theory, if you install all build tools, there should be no difference ..
Did a complete clean install of Ubuntu as I was having a similar issue with something else which wanted to call system python and became similarly unhappy. Still has this issue so thankfully it should be easy enough to replicate: Fresh install of Ubuntu 23.04 Install Miniforge/Mamba Follow steps to install Robostack Try to build a C++ package Next I'll try without the miniforge bit just in case it's that
Backdated to 22.04 LTS, all good. So something changes going from 22.04 to 23.04
I have the same problem on macos while trying to run this: https://docs.px4.io/main/en/ros/ros2_offboard_control.html#humble
@craig-m-k - could you please provide a detailed traceback of the error? MacOS will be easier for me to replicate than the ubuntu 23.04/22.04 difference.
Can you try passing -DPython3_FIND_STRATEGY=LOCATION
as additional cmake_arg, please?
We've confirmed that -DPython3_FIND_STRATEGY=LOCATION
finds the correct Python installation, and added it to the FAQ. Closing here.
Sorry, me again! I've given up and dual-booted a computer into Ubuntu linux so I've got a nearly-fresh install of 23.04. Following the instructions to install Robostack, I've hit trouble compiling a c++ module.
I've played about and removing the numpy in the environment allows it to work as it seems to drop back to system numpy. (I forced removal via pip as mamba throws an error). I also had to tweak /usr/include/python3.11/pyconfig.h to point directly to /usr/include/x86_64-linux-gnu/python3.11/pyconfig.h to get C++ modules to compile. Now I'm almost certain this is completely the wrong way to do it, I'm pretty sure there should be some way involving the --cmake-args colcon argument but I don't know what it is (I've tried several). So I feel like this is more of a documentation issue rather than anything wrong with RoboStack per se.
The environment is: