Could not find a version that satisfies the requirement sympy>=1.10.1

Finally I find the solution.

We need to change the python3 version, instead of python version, because the ubuntu.sh run python3 command in this script

You can check the python3 version by this way $python3 --version
You can change the python3 version by this command:

$sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

Most people only change python version by the
$update-alternatives --config python
However, it only changes the python version, instead of python3 version

After that , you can start run installation command

$bash ./PX4-Autopilot/Tools/setup/ubuntu.sh

However, there will be an new error

["ModuleNotFoundError: No module named 'apt_pkg'" appears in various commands](https://unix.stackexchange.com/questions/588066/modulenotfounderror-no-module-named-apt-pkg-appears-in-various-commands)

You can solve it by these command

sudo apt remove python3-apt
sudo apt autoremove
sudo apt autoclean
sudo apt install python3-apt

Finally I successfully solve this issue and can install the
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh

By the way, after this, I reboot but cannot login,
I guess the reason is the authority of some directory is changed by the upper commands
So I cannot login my ubuntu 18.04 even with correct password.

Finally, I solve this issue by the following commands to reinstall the ubuntu-desktop without losing any file and data.

sudo apt remove ubuntu-desktop

sudo apt update
sudo apt dist-upgrade
sudo apt autoremove
sudo apt clean

sudo apt install ubuntu-desktop

sudo shutdown -r now

After that, I find my terminal cannot be opened
Because the ubuntu 18.04 terminal cannot be executed by python 3.8
Thus I Ctrl + Alt + F3 and

sudo nano /usr/bin/gnome-terminal

Change #!/usr/bin/python3 to #!/usr/bin/python3.6.

1 Like