Cannot execute: required file not found

I’m not sure how to debug this. I’ve just upgraded Ubuntu(24.04 LTS) which could be the issue but I’m not sure what PIO is missing.

I try to run pio run but the only response I get is

$ pio run
bash: /usr/local/bin/pio: cannot execute: required file not found

But what file is it?
Should I just reinstall PIO and hope that solves it?

Then reinstall it. It might be that the python interpreter executable has changed.

rm -rf /usr/local/bin/pio
rm -rf ~/.platformio

then https://docs.platformio.org/en/latest/core/installation/methods/installer-script.html#super-quick-macos-linux

It seems to have helped. The quick install didn’t set up /usr/local/bin/pio but it’s easy enough to make a symlink.