Modern Fortran configuration in Vscode

You might want to try and installing some older fortls version since v2.1.2 appears to contain incompatible code with Python 3.6.

Try the following and start working backwards in versions until it works (available fortls versions)

pip install fortls==2.1.1

The underlying issue is that Python 3.6 has reached End Of Life in 2021-12-23 so developers (like us) have stopped writing code using only Python 3.6 feature. The only real solution is to use a version of Python (and an operating system) that is actively supported.