"Had trouble installing fortls, please install manually" . How to install manually without pip?

Pip is the python package manager included in all supported python installations; it’s a command line tool.

We can’t move away from Python (i.e. download an executable) what we can do is fix the user experience and make it to “just work” for the majority of our users.

The breakdown of the problem in Windows is:

  1. python and hence pip might not be reachable via PATH
  2. the folder in which pip installs applications is not by default reachable by PATH
  3. if not in PATH VSCode cannot find the applications
  4. Not being able to find fortls.exe raises the message you see.

It’s easy to enter into an infinite loop if step 1. works but not 2., i.e. you can install fortls but can’t reach via a terminal.

The manual solution I usually give is:

  • install python via the App store (or any other way you prefer)
  • in a new terminal Run python -m pip install fortls --user
  • in a terminal run python -m pip show fortls and make note of the Location
  • the fortls.exe should be located in a folder at the same level as <your prefix root>/lib/<other stuff> in a folder called Scripts
  • in VSCode’s global settings set the option
 "fortran.fortls.path": "<your prefix root>/Scripts/fortls.exe"

There is an active work package for this so if I don’t complete it myself in my free time it’s very likely I will post it as a GSoC project for next year.

2 Likes