0
$\begingroup$

I am on a Jetson nano, and I need to run ROS humble under a version of Python more recent than the 3.8 version in Ubuntu 20.04's APT repo. As such, I installed python 3.11.6 through pyenv, and built ROS2 humble from source. When I run my ros package (built with ament_python), however, my python scripts execute with the system's native python 3.8, even though pyenv still shows 3.11.6 as active, and if I run "python3" in the terminal, I get a 3.11.6 cli.

What is the best way of rectifying this? Is there a way to specify that a particular Python interpreter should be used?

I assume I will have to re-build from source, because ros2 seems to have built with python 3.8 for some packages, and 3.11 for others- when I do so, should I completely remove the native python3.8? Is that even safe to do on a Jetson nano?

Thanks!

$\endgroup$
1
  • $\begingroup$ Yes, you will have to rebuild it and set an env variable. Take a look at this question in the old ROS Forum. $\endgroup$ Commented Nov 18, 2023 at 10:55

1 Answer 1

1
$\begingroup$

If you build everything from source after the new version of python was setup everything should reference the new version of python.

You will need to make sure that you didn't build anything or have any cache files or things already partially built against the older python version in your workspace. And aren't using any system packages that rely on the system version of python.

A good link for past discussions of nuances: How do I specify the version of Python3 for ROS2?

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.