0
$\begingroup$

I installed ROS2 humble as per the instructions on https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html on Windows 11 WSL2 using Ubuntu 22.04. No issues during installation and everything appears to work well with Gazebo and RViz, but the moment I try to programmatically interact with the system using the rclpy library, I get the following error:

ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11'

The C extension '/opt/ros/humble/lib/python3.10/site-packages/_rclpy_pybind11.cpython-311-x86_64-linux-gnu.so' isn't present on the system.

Tried installing rclpy manually using the instructions found at https://github.com/ros2/rclpy and got the following error:

/home//rclpy_ws/src/rclpy/rclpy/src/rclpy/_rclpy_pybind11.cpp:18:10: fatal error: rcl/service_introspection.h: No such file or directory

I checked the /opt/ros/humble/lib/python3.10 directory and there is no site-packages subdirectory.

I tried uninstalling all of ROS2 using sudo apt-get remove ros-* and then reinstalling everything. Issue persists.

System Details

  • OS: Windows 11 using WSL2

  • Linux: Ubuntu 22.04

  • Python: 3.11.5 (Tried using Python 3.10; still failed)

  • ROS: ROS2 Humble

$\endgroup$

2 Answers 2

0
$\begingroup$

Not sure what the problem was but I installed a fresh Ubuntu distro and reinstalled everything and it worked. This is fine for my purposes, but I wish I knew what was wrong.

$\endgroup$
0
$\begingroup$

I was having the same issue and found that the root cause (for me at least) was the python version. Even though you said you tried Python 3.10, if you still have anaconda installed with a higher version, there's probably a weird mix up for what path of python is being read. Even when trying to reassign the path that ROS2 reads from I still kept getting the error.

What worked for me was removing anaconda completely so all that was left was the version of python that was pre-installed with my Ubuntu version being Python 3.10.12. Which at this point in time works with pybind11 and ROS2 Humble. (Including steps since I had to look them up cuz I'm a beginner lol)

To remove anaconda I just went to my home directory which is where I had anadonda installed and did the command:

  • rm -rf anaconda3/

Make sure after deleting anaconda to reroute the default path to that of Python 3.10 by first editing your bashrc with the command:

  • gedit ~/.bashrc

Then adding this line:

  • alias python3='/usr/bin/python3.10'

UPDATE: After doing this I added a few new packages to my workspace and tried building again and was getting errors where CMake was looking for python. Since we had built the old packages before we updated our python path, CMake sourced it from the old path. To combat this I just created a new workspace, built my packages again and moved over the non-default folders (folders not created by 'colcon build') to the new package(s).

$\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.