fortran-lang / vscode-fortran-support

Fortran language support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=fortran-lang.linter-gfortran
MIT License
221 stars 30 forks source link

bug: fortls installation fails on MS-Windows #1121

Open RossBoylan opened 4 months ago

RossBoylan commented 4 months ago

Is there an existing issue for this?

I have tried the Pre-Release of the extension.

Description

  1. Python installed on the computer (I had 3.12.4 and an earlier version).
  2. In VSCode open a directory with Fortran code.
  3. Open one of the files with fortran code (.f90 in my case). I'm not sure if this step is necessary.
  4. I got 2 notifications in VSCode, both about the need to install the Fortran language server. The first disappeared before I could get it. The 2nd was slightly different; I hit accept to install the server.

The result was "ERROR: pip: fortls failed with code 1" from Modern Fortran (which I think is this code). The log showed

Executing task: python3 -m pip install --user --upgrade fortls 

python3 : The term 'python3' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify 
that the path is correct and try again.
At line:1 char:1
+ python3 -m pip install --user --upgrade fortls
+ ~~~~~~~
    + CategoryInfo          
    : ObjectNotFound: (python3:String) [], CommandNotFoundException
    + FullyQualifiedErrorId 
    : CommandNotFoundException

Screenshots

No response

Expected Behaviour

The language server would be installed and would then be usable, at least aside from workspaces with their own Python virtual environments. The "then be usable" probably relates to a different bug, #957.

Version of Modern Fortran

3.4.2024061901

Version of Visual Studio Code

1.91.1

Platform and Architecture

MS-Windows Server 2019 Standard (Intel 64 bit)

Additional Information

I don't know if the invocation is using a shell, and if so what shell. But I can think of a number of possible problems:

  1. It's not using my PATH settings (which include C:\Program Files\Python312\Scripts\ and C:\Program Files\Python312\).
  2. Invocation should use Windows-specific py instead of python3.
  3. It needs to include the .exe extension (PowerShell sometimes behaves that way).

I realize the thing that actually invokes pip may not be part of this package, but this is where I'm seeing the problem. And I have been able to install other language servers automatically.

I have in the past installed the language server manually, which is probably what I'll do again to get around this problem.