tomoyafujita@~/DVT/04_DEVENV/ROS2/colcon_ws/src/ros2/sros2 >docker run --rm -it osrf/ros2:nightly-rmw-nonfree bash -lc '
. /opt/ros/$ROS_DISTRO/setup.sh
python3 --version
ls /opt/ros/rolling/lib/python3.12/site-packages/rclpy/_rclpy_pybind11* 2>/dev/null || echo "MISSING in python3.12 tree"
ls /opt/ros/rolling/lib/python3.14/site-packages/_rclpy_pybind11* 2>/dev/null || echo "MISSING in python3.14 tree"
python3 -c "import rclpy"
'
Python 3.12.3
MISSING in python3.12 tree
MISSING in python3.14 tree
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/ros/rolling/lib/python3.14/site-packages/rclpy/__init__.py", line 51, in <module>
from rclpy.context import Context as Context
File "/opt/ros/rolling/lib/python3.14/site-packages/rclpy/context.py", line 29, in <module>
from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
File "/opt/ros/rolling/lib/python3.14/site-packages/rclpy/impl/implementation_singleton.py", line 33, in <module>
rclpy_implementation = import_c_library('._rclpy_pybind11', package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/ros/rolling/lib/python3.14/site-packages/rpyutils/import_c_library.py", line 40, in import_c_library
return importlib.import_module(name, package=package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11'
The C extension '/opt/ros/rolling/lib/python3.14/site-packages/_rclpy_pybind11.cpython-312-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/rolling/How-To-Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
in recent osrf/ros2:nightly-rmw-nonfree images, the rclpy C extension is built for CPython 3.12 but installed into a CPython 3.14 site-packages directory. as a result, any import rclpy from the system python3 (which is 3.12 on the underlying Ubuntu base) fails with ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11', breaking every downstream package that imports rclpy during colcon test.
see https://github.com/ros2/sros2/actions/runs/27517565984/job/81328955375?pr=389
in recent osrf/ros2:nightly-rmw-nonfree images, the rclpy C extension is built for CPython 3.12 but installed into a CPython 3.14 site-packages directory. as a result, any import rclpy from the system python3 (which is 3.12 on the underlying Ubuntu base) fails with ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11', breaking every downstream package that imports rclpy during colcon test.