ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In short, you'll have to build from source. Here are the instructions for building ROS 2 on Linux: https://index.ros.org/doc/ros2/Installation/Eloquent/Linux-Development-Setup/

I'm guessing Python 3.7 was installed from source, or a different apt repo? In general, whether or not this will work is undefined. The safe assumption is that it won't work. This is not limited to ROS or to Python. Debian packages depend on other Debian packages. Assuming you're on Ubuntu Bionic, the eloquent packages were built using python3 from the official Ubuntu Bionic apt repos, in which python3 is python 3.6.

While it should be expected not to work, in this case a technical reason it doesn't work is because rclpy builds a cpython extension. This is ABI compatible only with the same version of python used to build it (Python 3.6). There's more info about ABI compatibility of extension libraries in PEP 3149.


I can change the symlink to python3.6 and it works fine. I prefer to avoid that.

I'd strongly recommend against changing the system install of python via symlinks. Let your package manager handle that. rclpy is not the only package that will be broken. In general, once you stop using your package manager to install a package, you need to install every package that depends on it from source too.

I tried changing ROS_PYTHON_VERSION from "3" to "3.6" but that seems to have no effect.

ROS_PYTHON_VERSION is used to indicate the major version of python. Allowed values are 2 or 3. This is only useful for ROS 1, since ROS 2 only supports python 3. It was created to support conditional dependencies, see REP 149.

ros2 clearly depends on Python3.6. Is there a clean way of specifying this? Where should I have found it?

Debian packages list their dependencies. Running apt show ros-eloquent-rclpy will show that ros-eloquent-rclpy depends on libpython3.6.