-
Notifications
You must be signed in to change notification settings - Fork 142
Description
I've come across some concerning behavior when you install python3.12-dev on Ubuntu 22.04. It breaks ament_cmake_python due to the removal of distutils! I was hoping to work with a friend who uses MacOS and we had some python3.12 specific issues, so naturally, I just added it to my system.
ryan@B650-970:~/Dev/ros2_ws/src/ardupilot$ sudo apt install python3.12-dev
...
But now, if you try to colcon build, I am no longer able to build.
ryan@B650-970:~/Dev/ros2_ws/src/ardupilot$ colcon build
...
Traceback (most recent call last):
File "/home/ryan/Dev/ros2_ws/src/ardupilot/build/ardupilot_msgs/ament_cmake_python/ardupilot_msgs/setup.py", line 1, in <module>
from setuptools import find_packages
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 10, in <module>
import distutils.core
ModuleNotFoundError: No module named 'distutils'
gmake[2]: *** [CMakeFiles/ament_cmake_python_build_ardupilot_msgs_egg.dir/build.make:70: CMakeFiles/ament_cmake_python_build_ardupilot_msgs_egg] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:447: CMakeFiles/ament_cmake_python_build_ardupilot_msgs_egg.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< ardupilot_msgs [1.93s, exited with code 2]
Summary: 0 packages finished [2.51s]
1 package failed: ardupilot_msgs
1 package had stderr output: ardupilot_msgs
2 packages not processed
This is super odd, because my system python3 still refers to the 3.10.12 version that is default with Ubuntu 22, not the optional 3.12 I just added.
ryan@B650-970:~/Dev/ros2_ws/src/ardupilot$ which python3
/usr/bin/python3
ryan@B650-970:~/Dev/ros2_ws/src/ardupilot$ python3 --version
Python 3.10.12
Perhaps there is a way using apt to indicate that you can't have ros-humble-ament-cmake-python/jammy,now 1.3.7-1jammy.20240125.200351 and python3.12-dev at the same time, much like you can't have gazebo classic and gazebo harmonic binaries at the same time.
See the below linked thread for a potential workaround. My hope in filing this issue is perhaps there is something that can be added to provide visibility to the issue if others run into it. Perhaps there can be better protection in the build tooling to prevent users from installing python3.12 or detect the user is using python3.12 at build time and fail more gracefully.
Originally posted by @Ryanf55 in #382 (comment)