0
$\begingroup$

Rosanswers logo

Trying to Colcon build ROS2 Rolling (https://docs.ros.org/en/rolling/Installation/Ubuntu-Development-Setup.html), I've faced this error:

colcon build --symlink-install

Starting >>> rclpy
--- stderr: rclpy

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Python3 (missing: Python3_LIBRARIES Python3_INCLUDE_DIRS Development) (found version "3.9.10") Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindPython/Support.cmake:2214 (find_package_handle_standard_args)
/usr/share/cmake-3.16/Modules/FindPython3.cmake:300 (include) CMakeLists.txt:40 (find_package)

--- Failed <<< rclpy [5.33s, exited with code 1]

My system Python is 3.8.10, my system Ubuntu 20.04. From the logs, it looks like 3.8 is not being found, while 3.9 is picked instead (3.9 is installed too on my system). The other 300s or so packages of ROS2 Rolling installed without issues.


Originally posted by lorepieri on ROS Answers with karma: 50 on 2022-03-24

Post score: 0


Original comments

Comment by lorepieri on 2022-07-20:
https://stackoverflow.com/questions/71606313/colcon-build-fail-rclpy/73048567#73048567

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I believe the error was due to colcon picking up the anaconda python, instead of the default OS python (3.8.10 in my case).

Sometimes rclpy fails to be imported because the expected C extension libraries are not found. If so, compare the libraries present in the directory with the one mentioned in the error message. Assuming a file with a similar name exists (same prefix like _rclpy. and same suffix like .so but a different Python version / architecture) you are using a different Python interpreter than which was used to build the C extension. Be sure to use the same Python interpreter as the one used to build the binary.

https://docs.ros.org/en/rolling/How-To-Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system


Originally posted by lorepieri with karma: 50 on 2022-07-20

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by martimorta on 2022-07-21:
Hi, did rebuilding the workspace as indicated in the link fix the problem? If not and you fixed the issue, could you edit the answer explaining how you did it? Many thanks!

Comment by lorepieri on 2022-07-21:
Not tested sorry, I've settled for installing galactic from apt-get.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.