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

I am a long term user of Fortran, now I need to use it under Windows with VScode and gfortran. I did it a couple of years with Modern Fortran extension, now it seems things are changed a little bit. Soon after I install the Modern Fortran extension, it suggests to install fortls. I click yes and it says: “Had trouble installing fortls, please install manually”. By looking online and scrolling Modern Fortran help page, everyone says to use pip. Why are you guys assuming everyone knows what pip is? Older folks like me don’t know how to use Phyton (Google pointed to Phyton when googling pip). Why cant the Modern Fortran extension simply download fortls and anything else it needs? Is there a way to install fortls by downloading and double-clicking an executable? If not, please guide us on the fastest way to learn how to install things with pip. Thank you a lot.

2 Likes

Please follow the instructions here: Had trouble installing fortls.

I already saw that, and it says to use pip, I do not know how to use pip. You should please update the manual for people who are not pip-friendly, please! ( I even less know about that anaconda)

1 Like

Generally pip is installed by default. If not, then follow the instructions here to install pip: pip install. But before doing this, again check whether pip is installed in your system?

What should I look for? for a file named pip.exe everywhere in my drives? I do not know how to use Python, is there any way I can do this without pip/python and just by installing a fortls executable? Some instruction from people who do not know all of this should be added please.

1 Like

Thanks for asking this question, @venexiano. I have the same problem and I find it quite strange that modern fortran (which otherwise is a very useful tool for Fortran coders like me) does not handle this automatically. Also, no idea what pip is.

1 Like

@venexiano, @aledinola we need to make all these extensions standalone and either not depend on Python, or ensure things get installed automatically on all platforms. If there is anybody here who has time to help, please contact @gnikit, he will get you started. Let’s improve this.

2 Likes

@venexiano @aledinola, if it might be of help in the mean time a full stand alone installation can be done:

Download the Anaconda package manager from here:

Once you install it, look for the “Anaconda Prompt”, which can replace your use the command line windows
image

You’ll see the “(base)”, it means that anaconda has created a base installation of python and other packages as reference. You could create a virtual environment afterwards but let’s keep it simple, so forget about it for the moment…

Now, here you can use either “python -m pip install <name_of_the_module>” or “conda install …”
“pip” is the reference package installer of python. Anaconda came afterwards to help resolve problems that can arise when a given package has dependencies that do not correspond to the version installed in your system. My advise, prefer “conda install” over “pip install” whenever possible … BUT, not all packages are available through conda, so in that case just use “python -m pip install”.

Last advise, if you open your projects from the Anaconda prompt you would make sure that the terminal in VSCode is already pointing to this prompt, would strongly advise you to do that

From the Anaconda prompt:

> cd path\of\your\project
> code .

The second line will open VSCode on your folder with your environment set.

2 Likes

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

Hello @gnikit, I hope this message finds you well. I recently came across this discussion regarding the challenges with Python and pip integration in the Fortran environment. While I’m relatively new to Fortran lang and might not have extensive knowledge in the field yet but I’m enthusiastic about contributing meaningfully to the improvement of the user experience within the Fortran community. Could you please provide more insights into the current status of this project or any steps already taken in this direction? Additionally, I’m eager to know how I might get involved or contribute effectively to this. Thank you for your time and consideration :slight_smile: