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

need to get tf2_ros to work in python3 environment for Melodic

asked 2022-04-20 03:56:24 -0600

distro gravatar image

I need tf2 to work in python3 environment in ROS melodic. I saw a similar question here for ROS kinetic, I need the same thing for melodic. Please help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-04-20 12:21:31 -0600

tfoote gravatar image

On Melodic the binary installation of ROS is built against the python2 (REP 3) version on the system.

If you want to use tf2_ros or any other python elements of ROS Melodic in python3 you need to build it from source in an environment where python3 is the default. We made the effort to test all packages up to desktop and they are generally expected to work with python3 in Melodic. Beyond that you may find packages that are not dual compatible.

You will have to modify the source installation instructions to setup python3 in your environment. Make sure to always be in the python3 environment when interacting with that installation. You will also have to install all the python depeendencies into your python3 environment manually, and the rosdeps on melodic will install the python2 dependencies as that's what the default is for melodic.

If you move forward to noetic the default is python3 and you can use it there.

edit flag offensive delete link more

Comments

@tfoote is the solution provided in this similar question work for ros kinetic?

distro gravatar image distro  ( 2022-04-20 15:26:03 -0600 )edit

There are lots of shortcuts that you can take if you know what you're doing. However I'll caution that if you try to do just part of it, you're going to run into issues trying to use python2 libraries which might be shared dependencies of potential downstream packages. You need to have python3 environments and python2 environments non-overlapping. It's really easy to shoot yourself in the foot. And if you're asking how to solve it here I would not recommend you try the more advanced ways or shortcuts.

tfoote gravatar image tfoote  ( 2022-04-20 16:36:50 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-04-20 03:56:24 -0600

Seen: 344 times

Last updated: Apr 20 '22