Modern Fortran Manual Installation Error

Hello everyone,

I am trying to install on my company pc the Modern Fortran extension but if I try to do so I end up with the following error:

" [“Invalid: Corrupt ZIP: end of central directory record signature not found”," at G.downloadExtension (vscode-file://vscode-app/c:/Software/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:88:195231)“,” at async G.doRun (vscode-file://vscode-app/c:/Software/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:88:194173)"] "

Since this might be due to the firewalls in place in the pc (although other extensions are installed without a problem), I tried to install it manually. I downloaded the "fortran-lang.linter-gfortran-3.2.0 " file and then I installed it from VSIX as instructed by VS code. However, I find the same error.

Does anyone have any suggestion or explaination on why it is doing so?

Thanks a lot,
Giulio

what version of VS Code are you using? It sounds like you need to update VS Code, you need version 1.63.0+. Unfortunately, VS Code does not offer an elegant way to display version incompatibility, so it ends up printing cryptic errors.

I have version 1.72.0, which i think is the latest one.

Can you try and install cpptools C++ programming with Visual Studio Code and see if that is possible

I tried directly from VS code and gave me the same error. Then, I did it manually and it was fine, so now i have c++.

So it is probably your security options. Try and install the Modern Fortran extension now the same way from a local vsix. I suspect it was failing before because it was unable to fetch the C++ extension which we depend on for debugging.

Yes indeed now i was able to install Modern Fortran. However now the c++ extension gives the following two errors:

Missing binary at … .vscode\extensions\ms-vscode.cpptools-1.12.4\bin\cpptools.exe

It says that it is not possible to launch the server, therefore the intellisense functionalities are disabilitated.

The C++ extension installed does not correspond to the system

(I am translating so sorry if it is not clear)

In any case i tried to move the path to which extensions are installed since the problem migth be running some executables, and to do so in this computer without issues i need to have it in a particular folder.

I tried to use the following command:

code --extensions-dir C:\Software\VS_extension

But what it did was to open a new vs code window and create a misterious extension file. If the i try to install extension it does not follow the directory written above.

You don’t need cpptools.exe to use the Modern Fortran extension, you only need some of its functionality when you are debugging.

At any rate, maybe the following will help resolve your issue.
The cpptools does a bunch of stuff online so that could be why it’s failing. I don’t think it lack of permissions and cpptools.exe should be present in an offline installation, so I would suggest you reinstall:

  • Uninstall Modern Fortran and cpptools.
  • Go into the directory where extensions are installed, that would be the thing you quoted above … .vscode\extensions
  • Delete any residual folders by the name fortran-lang.linter-gfortran... and ms-vscode.cpptools...
  • Download a fresh copy from the Marketplace for your OS for cpptools, see Version History. This should come with cpptools.exe preinstalled. You can check yourself after the download by looking into the vsix file, it’s just a compressed folder.
  • Download a fresh copy from the Marketplace for your OS for Modern Fortran, see Version History

If that fails might need to speak with your IT department to help you resolve this.

Ok thank you very much!

Just one last thing. Since i also need to install fortls is there a way to bypass the pip installation? I tried doing the

pip install fortls

command but i think the security is blocking it. I tried to download the forls.tar.gz file but from there the instructions i found on the internet are not very clear. If you have any solution to this problem it would be very appreciated. Thank you in any case for your availability!!

You can do a few things:

You will have to disable autoupdating since it will interfere with your firewall settings. For more please read the Configuration options - fortls documentation.

Thank you! I was able to install fortls however vs code deosn’t seem to aknowledge it. I used the command

“fortran.fortls.path”: “c:/software/winpython/wpy64-3850/python-3.8.5.amd64/lib/site-packages”

where i got the path by using pip show fortls, which gave back:

Name: fortls
Version: 2.13.0
Summary: fortls - Fortran Language Server
Home-page: fortls
Author: Giannis Nikiteas
Author-email: giannis.nikiteas@gmail.com
License: MIT
Location: c:\software\winpython\wpy64-3850\python-3.8.5.amd64\lib\site-packages
Requires: json5, packaging
Required-by:

Do you know why is this the case? (I also tried adding /fortls to the path but to no good)

Unfortunately pip show will show you the installation location of the Python library not where the binary i.e. fortls is installed. In a command prompt you can type

where fortls

or in a Shell terminal

which fortls

and that will give you the path you need to use.

In general, most times you can make a safe bet that that binaries are installed close to where the python module is installed in a folder called bin. So if you start snooping around c:\software\winpython\wpy64-3850\python-3.8.5.amd64\ (maybe some directories up) you will find it).

Ok i did so! Now i have the following error:

Error launching fortls: Please check that all selected options are supported by your language server version.

What could it be?

There should be a log message in the Output>Modern Fortran channel attached to that.

If you haven’t input any custom settings I would guess that the location shows py pip show fortls needs to be appended to your PYTHONPATH variable. That’s not exclusive to fortls any Python program that you try to run and the lib/ location is not part of your PYTHONPATH will fail because it won’t be able to resolve the relative imports of the package.

Looking into the output i find:

[2022-10-13 15:56:03.175] [renderer1] [warning] Settings pattern “keyboard.*” doesn’t match any settings

[2022-10-13 15:56:05.184] [renderer1] [error] [Extension Host] (node:17204) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

(Use Code --trace-deprecation ... to show where the warning was created)

[2022-10-13 15:56:05.249] [renderer1] [warning] Settings pattern “keyboard.*” doesn’t match any settings

[2022-10-13 15:56:06.516] [renderer1] [warning] Settings pattern “keyboard.*” doesn’t match any settings

[2022-10-13 15:56:10.271] [renderer1] [warning] Settings pattern “keyboard.*” doesn’t match any settings

How do i add the fortls program to the pythonpath variable?

By the way thank you so much for your patience and for the advices!

Try this