Waf: Update waf submodule to Ardupilot/waf master. User setup errror

Cant build via sitl unless I pull latest master waf submodule

Waf: Update waf submodule to Ardupilot/waf master. by kwikius · Pull Request #26119 · ArduPilot/ardupilot · GitHub

Looks like you skipped this step which proves the mapping to support the legacy /usr/bin/env python environment.

Next time, can you post your operating system and version?

1 Like

@rfriedman Thanks. That has solved it. That was an annoying problem I have had for a while!

Operating system and version:

Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy

Glad it worked. If you have time, we could use help updating all the shebangs to python3. Would you have any interest in a contribution to that?

@rfriedman Sure, I will see what I can do about that. I have done a search through the codebase and there seem to be quite a lot of places. Shall I post the list here or on github in an issue or what?

We can discuss on here if you like.

File attached. There are some at the end which aren’t shebangs but are maybe related or seem to use python rather than python3 … whetever
shebangs_out.txt (57.3 KB)

Thanks. Here’s the PEP with recommendations. Seems complicated given all the submodules.

I’d like to involve the dev team on a recommendation.

On Ubuntu 22, we do not set up the development chain in virtual environment or require use of virtualization.
Applications designed exclusively for a specific environment (such as a container or virtual environment) may continue to use the python command name.

Thus, it seems like what ArduPilot is doing is not recommended, and switching to python3 is a in line with the recommendations of PEP-0394.

Because python2 is EOL, it is my impression the proper long term fix should perform the following

  • Update dependencies to use python3 shebang
  • Update ArduPilot to use python3 shebang
  • Update the WiKi somewhere that python2 is EOL
  • Remove support for Ubuntu 18.04 and other old distros that treat /usr/bin/env python and python2
  • Have as many as devs check they can compile and run SITL
  • Update the build server and necessary infrastructure that relies on python2

If the above causes issues on certain distributions, then perhaps it’s time to require virtual environments.

1 Like

I’d be happy with /usr/bin/env python3

Since Ubuntu 20.04, about 3 years ago, u can sudo apt install python-is-python3 and/or sudo apt install python-is-python2 . You can also do sudo update-alternatives --config python to change what “python” means in anything since about 2017, and that lets u switch between not just 2 and 3, but diffeent 3.x versions as well. Why not just let the user decide, there’s tools for that.

I am relatively clueless about the deeper parts of the issue, except this isn’t the only place I came across it, so ideally the solution should work whether the user has installed aliases to python, python2, python3 etc or not, similarly I hope that we don’t take the step of having to use a virtual environment( but sure explain the benefits and disadvantages in the docs)

As few hurdles to getting things running as possible for us mortals would be my preference.

Will there be any potential problems from ardupilot devs explicitly using python3 versus python in the shebang? If not then surely it is best to always be explicit about which version of python is required?

Of note, is that because python2 is EOL, we shouldn’t need python-is-python3. ArduPilot has already removed python2 support in most of the toolchain.

The reason your environment was not working was that you skipped an important step. As long as the script works, ArduPilot should be able to change what it does under the hood.

Also, new distros recommend using virtual environments or system packages and not use user python packages, and we already have support for that.

Apologies, but I’m unclear as to what you are saying now? Do you still want all the shebangs to be changed to python3?

Yea, do it. Start in the dependencies, and work your way up. Let me know if you get stuck, or need a review.

As far as when ArduPilot will remove python-is-python3 - they said 1 year from yesterday. They want to give users of Ubuntu 18.04 another year to migrate even though the distro is EOL. Pete Hall said VSCode recently broke 18.04 and had to undo that breakage becasue there’s still apparently a fair number of people doing their development on very old distros.

Pull requests done for ArduPilot and submodules that have versions in ArduPilot github repository

1 Like