I am working with the Modern Fortran extension in Visual Studio Code on Windows and keep encountering a persistent issue. Despite having correctly installed findent, fortran-language-server, and fprettify using a specific Python interpreter and updating my user settings.json in VS Code to include the necessary path, the extension does not seem to recognize findent, and I continue to receive the following message:
Installing findent.exe through pip with --user option
Source: Modern Fortran
Here are the steps I've taken:
- Selected the Python interpreter inside Visual Studio Code explicitly set to
C:\Users\<userName>\AppData\Local\Programs\Python\Python312\python.exe. - Installed the required packages with the commands:
C:\Users\<userName>\AppData\Local\Programs\Python\Python312\Scripts\pip.exe install findent --userC:\Users\<userName>\AppData\Local\Programs\Python\Python312\Scripts\pip.exe install fortran-language-serverC:\Users\<userName>\AppData\Local\Programs\Python\Python312\Scripts\pip.exe install fprettify
- Added the following to my
settings.jsonto ensure the VS Code terminal recognizes the scripts installed bypip:"terminal.integrated.env.windows": { "PATH": "${env:PATH};C:\\Users\\<userName>\\AppData\\Roaming\\Python\\Scripts;" }
Despite these configurations, indentation, beautifying, and prettifying for Fortran code do not work, and I keep seeing the prompt to install findent.
Has anyone faced a similar issue, or can you offer insight into what might be missing or incorrectly configured in my setup?

In Modern Fortran, Windows autodetection of Python packages is a bit problematic at the moment, see PR and GSoC project.
Solution 1: quick
That being said for users that don't have the default pip location added to their
PATH, a very low effort, platform independent, workaround is shown in this comment.Solution 2: long
If you want to get it working without the aforementioned workaround, you will have to:
fortran.logging.levelto DEBUG, your VS Code OUTPUT pane should now contain all sorts of useful messages under Modern Fortran.Formatting
fprettifycopy the directory wherepipinstalls the.exefortran.formatting.pathequal to that directory (withoutfprettiffy.exe, just the full directory).Language server
fortlsnotfortran-language-server. Install viapip install fortls --preto install the pre-release (highly recommended).fortls.exefortran.fortls.pathto install directory + fortls.exe in your VS Code settings (quite annoying that the formatter and this option require slightly different inputs, we will fix in a future release).The debug logs in the OUTPUT pane will be extremely helpful when you are trying to setup your machine.
As a side note, I think Step 3. should not work for any VS Code extension, unless they have gone out of their way to implement such functionality. The VS Code extension environment knows nothing about the VS Code terminal
PATH. I think the terminal inherits from the VS Code environment, not the other way around.