Hey everyone, I am currently trying to set up a fresh WSL environment for my new Fortran project. I just executed wsl --install
on the Windows terminal and then installed the packages listed below inside the Ubuntu OS. However, during the process of installing fortls and its configuration in the modern Fortran extension in VSCode I stumbled upon the following problem during the language server initialization when starting VSCode.
PermissionError: [Errno 13] Permission denied: '/proc/355/map_files'
[Error - 12:53:25 PM] Server initialization failed.
Message: [Errno 13] Permission denied: '/proc/355/map_files'
Code: -32603
[object Object]
[Error - 12:53:25 PM] Fortran Language Server client: couldn't create connection to server.
Message: [Errno 13] Permission denied: '/proc/355/map_files'
Code: -32603
[object Object]
My understanding of Linux is quite limited, but files in the /proc/ directory are usually kernel-level, right? So, first of all, I am wondering why fortls needs access to these directories. Second, shouldn’t access be automatically configured when executing pip install fortls
? Also is there an easy fix for this?
I appreciate your help in advance.
Background information:
Fresh/Clean WSL with:
WSL-Version: 2.3.26.0
Kernelversion: 5.15.167.4-1
WSLg-Version: 1.0.65
MSRDC-Version: 1.2.5620
Direct3D-Version: 1.611.1-81528511
DXCore-Version: 10.0.26100.1-240331-1435.ge-release
Windows-Version: 10.0.22631.4460
Ubuntu version:
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble
Installed packages:
git-all
gh
pre-commit
gfortran
python3-pip
python3.12-venv
fortls
fortls
and pre-commit
are pip installed in the python environment. The environment is set in the root directory of the project.
VSCode settings.json
{
"fortran.fortls.path": "./venv/bin/fortls",
"fortran.logging.level": "Debug",
"fortran.fortls.notifyInit": true,
}
VSCode extensions:
Python extensions (Python, Pylance, Python Debugger)
Modern Fortran
C/C++
GitHub Copilot
Jupyter
WSL
Remote SSH
Full Modern Fortran Output
[INFO - 12:53:19 PM] Extension Name: Modern Fortran
[INFO - 12:53:19 PM] Extension Version: 3.4.0
[INFO - 12:53:19 PM] Linter set to: "gfortran"
[INFO - 12:53:19 PM] Formatter set to: "findent"
[INFO - 12:53:19 PM] Autocomplete set to: "fortls"
[INFO - 12:53:19 PM] Hover set to: "fortls"
[INFO - 12:53:19 PM] Symbols set to: "fortls"
[INFO - 12:53:19 PM] [lint] Found GNU Fortran version 13.2.0
[DEBUG - 12:53:19 PM] [lint] Using Modern GNU Fortran diagnostics: true
[DEBUG - 12:53:19 PM] [lint] arguments:
[
"-ffree-line-length-none",
"-ffixed-line-length-none",
"-Wall"
]
[DEBUG - 12:53:19 PM] [lint] moduleOutput: -J /home/jonas/.vscode-server/data/User/workspaceStorage/7d18cd3d298f2c77839c0c7c42d329b5/fortran-lang.linter-gfortran/include
[DEBUG - 12:53:19 PM] [lint] Initialising cache for linter.includePaths
[DEBUG - 12:53:19 PM] [lint] glob paths:
[]
[DEBUG - 12:53:19 PM] [lint] resolved paths:
[]
[DEBUG - 12:53:19 PM] [build.single] compiler: "gfortran" located in: "/usr/bin/gfortran"
[INFO - 12:53:19 PM] [build.single] Compiler query command line: /usr/bin/gfortran -fsyntax-only -cpp -fdiagnostics-plain-output -ffree-line-length-none -ffixed-line-length-none -Wall -J /home/jonas/.vscode-server/data/User/workspaceStorage/7d18cd3d298f2c77839c0c7c42d329b5/fortran-lang.linter-gfortran/include -ffree-form -o /home/jonas/code/combustion-sph/src/kernel_gaussian.f90.o /home/jonas/code/combustion-sph/src/kernel_gaussian.f90
[DEBUG - 12:53:19 PM] [lsp.client] Fortran Language Server -- constructor
[DEBUG - 12:53:19 PM] [lsp.client] Assuming relative fortls path is to /home/jonas/code/combustion-sph
[DEBUG - 12:53:19 PM] [lsp.client] Language Server arguments:
[
"--enable_code_actions",
"--hover_signature",
"--use_signature_help",
"--lowercase_intrinsics",
"--nthreads=4",
"--notify_init",
"--incremental_sync"
]
[DEBUG - 12:53:19 PM] [lsp.client] Assuming relative fortls path is to /home/jonas/code/combustion-sph
[DEBUG - 12:53:19 PM] [lsp.client] Language Server version: 3.1.2
[INFO - 12:53:19 PM] [lsp.client] Initialising Language Server for workspace: file:///home/jonas/code/combustion-sph
[INFO - 12:53:19 PM] [lsp.client] Language Server arguments: --enable_code_actions --hover_signature --use_signature_help --lowercase_intrinsics --nthreads=4 --notify_init --incremental_sync
[DEBUG - 12:53:19 PM] [build.single] Compiler output:
[DEBUG - 12:53:19 PM] [lint] No linting diagnostics to show
error handling request {'jsonrpc': '2.0', 'id': 0, 'method': 'initialize', 'params': {'processId': 14775, 'clientInfo': {'name': 'Visual Studio Code', 'version': '1.95.3'}, 'locale': 'en', 'rootPath': '/home/jonas/code/combustion-sph', 'rootUri': 'file:///home/jonas/code/combustion-sph', 'capabilities': {'workspace': {'applyEdit': True, 'workspaceEdit': {'documentChanges': True, 'resourceOperations': ['create', 'rename', 'delete'], 'failureHandling': 'textOnlyTransactional', 'normalizesLineEndings': True, 'changeAnnotationSupport': {'groupsOnLabel': True}}, 'configuration': True, 'didChangeWatchedFiles': {'dynamicRegistration': True, 'relativePatternSupport': True}, 'symbol': {'dynamicRegistration': True, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, 'tagSupport': {'valueSet': [1]}, 'resolveSupport': {'properties': ['location.range']}}, 'codeLens': {'refreshSupport': True}, 'executeCommand': {'dynamicRegistration': True}, 'didChangeConfiguration': {'dynamicRegistration': True}, 'semanticTokens': {'refreshSupport': True}, 'fileOperations': {'dynamicRegistration': True, 'didCreate': True, 'didRename': True, 'didDelete': True, 'willCreate': True, 'willRename': True, 'willDelete': True}, 'inlineValue': {'refreshSupport': True}, 'inlayHint': {'refreshSupport': True}, 'diagnostics': {'refreshSupport': True}}, 'textDocument': {'publishDiagnostics': {'relatedInformation': True, 'versionSupport': False, 'tagSupport': {'valueSet': [1, 2]}, 'codeDescriptionSupport': True, 'dataSupport': True}, 'synchronization': {'dynamicRegistration': True, 'willSave': True, 'willSaveWaitUntil': True, 'didSave': True}, 'completion': {'dynamicRegistration': True, 'contextSupport': True, 'completionItem': {'snippetSupport': True, 'commitCharactersSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'deprecatedSupport': True, 'preselectSupport': True, 'tagSupport': {'valueSet': [1]}, 'insertReplaceSupport': True, 'resolveSupport': {'properties': ['documentation', 'detail', 'additionalTextEdits']}, 'insertTextModeSupport': {'valueSet': [1, 2]}, 'labelDetailsSupport': True}, 'insertTextMode': 2, 'completionItemKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}, 'completionList': {'itemDefaults': ['commitCharacters', 'editRange', 'insertTextFormat', 'insertTextMode']}}, 'hover': {'dynamicRegistration': True, 'contentFormat': ['markdown', 'plaintext']}, 'signatureHelp': {'dynamicRegistration': True, 'signatureInformation': {'documentationFormat': ['markdown', 'plaintext'], 'parameterInformation': {'labelOffsetSupport': True}, 'activeParameterSupport': True}, 'contextSupport': True}, 'definition': {'dynamicRegistration': True, 'linkSupport': True}, 'references': {'dynamicRegistration': True}, 'documentHighlight': {'dynamicRegistration': True}, 'documentSymbol': {'dynamicRegistration': True, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, 'hierarchicalDocumentSymbolSupport': True, 'tagSupport': {'valueSet': [1]}, 'labelSupport': True}, 'codeAction': {'dynamicRegistration': True, 'isPreferredSupport': True, 'disabledSupport': True, 'dataSupport': True, 'resolveSupport': {'properties': ['edit']}, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports']}}, 'honorsChangeAnnotations': False}, 'codeLens': {'dynamicRegistration': True}, 'formatting': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True}, 'onTypeFormatting': {'dynamicRegistration': True}, 'rename': {'dynamicRegistration': True, 'prepareSupport': True, 'prepareSupportDefaultBehavior': 1, 'honorsChangeAnnotations': True}, 'documentLink': {'dynamicRegistration': True, 'tooltipSupport': True}, 'typeDefinition': {'dynamicRegistration': True, 'linkSupport': True}, 'implementation': {'dynamicRegistration': True, 'linkSupport': True}, 'colorProvider': {'dynamicRegistration': True}, 'foldingRange': {'dynamicRegistration': True, 'rangeLimit': 5000, 'lineFoldingOnly': True, 'foldingRangeKind': {'valueSet': ['comment', 'imports', 'region']}, 'foldingRange': {'collapsedText': False}}, 'declaration': {'dynamicRegistration': True, 'linkSupport': True}, 'selectionRange': {'dynamicRegistration': True}, 'callHierarchy': {'dynamicRegistration': True}, 'semanticTokens': {'dynamicRegistration': True, 'tokenTypes': ['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator'], 'tokenModifiers': ['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'], 'formats': ['relative'], 'requests': {'range': True, 'full': {'delta': True}}, 'multilineTokenSupport': False, 'overlappingTokenSupport': False, 'serverCancelSupport': True, 'augmentsSyntaxTokens': True}, 'linkedEditingRange': {'dynamicRegistration': True}, 'typeHierarchy': {'dynamicRegistration': True}, 'inlineValue': {'dynamicRegistration': True}, 'inlayHint': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['tooltip', 'textEdits', 'label.tooltip', 'label.location', 'label.command']}}, 'diagnostic': {'dynamicRegistration': True, 'relatedDocumentSupport': False}}, 'window': {'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'showDocument': {'support': True}, 'workDoneProgress': True}, 'general': {'staleRequestSupport': {'cancel': True, 'retryOnContentModified': ['textDocument/semanticTokens/full', 'textDocument/semanticTokens/range', 'textDocument/semanticTokens/full/delta']}, 'regularExpressions': {'engine': 'ECMAScript', 'version': 'ES2020'}, 'markdown': {'parser': 'marked', 'version': '1.1.0'}, 'positionEncodings': ['utf-16']}, 'notebookDocument': {'synchronization': {'dynamicRegistration': True, 'executionSummarySupport': True}}}, 'trace': 'off', 'workspaceFolders': [{'uri': 'file:///home/jonas/code/combustion-sph', 'name': 'combustion-sph'}]}}
Traceback (most recent call last):
File "/home/jonas/code/combustion-sph/venv/lib/python3.12/site-packages/fortls/langserver.py", line 173, in handle
resp = handler(request)
^^^^^^^^^^^^^^^^
File "/home/jonas/code/combustion-sph/venv/lib/python3.12/site-packages/fortls/langserver.py", line 202, in serve_initialize
self._resolve_globs_in_paths()
File "/home/jonas/code/combustion-sph/venv/lib/python3.12/site-packages/fortls/langserver.py", line 1664, in _resolve_globs_in_paths
source_dirs.update(set(only_dirs(resolve_globs(path, self.root_path))))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jonas/code/combustion-sph/venv/lib/python3.12/site-packages/fortls/helper_functions.py", line 372, in resolve_globs
return [str(p.resolve()) for p in Path(root).glob(rel)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/pathlib.py", line 1096, in glob
for p in selector.select_from(self):
File "/usr/lib/python3.12/pathlib.py", line 235, in _select_from
for starting_point in self._iterate_directories(parent_path):
File "/usr/lib/python3.12/pathlib.py", line 229, in _iterate_directories
for dirpath, dirnames, _ in parent_path.walk():
File "/usr/lib/python3.12/pathlib.py", line 1140, in walk
for entry in scandir_it:
PermissionError: [Errno 13] Permission denied: '/proc/355/map_files'
[Error - 12:53:25 PM] Server initialization failed.
Message: [Errno 13] Permission denied: '/proc/355/map_files'
Code: -32603
[object Object]
[Error - 12:53:25 PM] Fortran Language Server client: couldn't create connection to server.
Message: [Errno 13] Permission denied: '/proc/355/map_files'
Code: -32603
[object Object]