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

When installing the newest the simulation on Ubuntu 18.04, according to this

There is an error, when executing the following command

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

Then, I tried to fix by

sudo apt install python-sympy

According to this link: python3 - How to install sympy for Python 3.4 - Ask Ubuntu
However, it still does not work

Thank you very much for your help

Try updating pip or using a newer python version.

1 Like

Thanks for the reply
I think the issue is the python version should be upper than 3.8
However, the latest python version for ubuntu 18.04 is python 3.6
Thus, I am thinking whether I should use git checkout to change the release version of the PX4-Autopilot
However, I am not sure which release version of the PX4-Autopilot is suitable for ubuntu 18.04

Then, I update the python version 3.8.16 by this way

Then, I switch the python version to 3.8.16
http://web.mit.edu/6.00/www/handouts/pybuntu.html
Then, I install sympy version to 1.12.dev version by this way

However, I still get this error:

I also tried different version sympy, such as 1.10.1
but it still does not work

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.

Glad you got it figured out. Apologies for not adding more detail, I should have mentioned setting up a virtual environment so it doesn’t effect the rest of your os.

Here’s a stack overflow question with some good info for anyone else reading this

1 Like