WolframResearch/vscode-wolfram

Starting client failed

rih-evo opened this issue · 8 comments

I'm having problems using this extension.

System is Windows 10 Enterprise.
Wolfram Engine Installed on default folder
C:\Program Files\Wolfram Research\Wolfram Engine\13.1

The kernel works fine by itself.

image

Output tab shows:

[Error - 13:53:16] Starting client failed
Launching server using command "C:\Program Files\Wolfram Research\Wolfram Engine\13.1\WolframKernel.exe" failed.

My settings.json files is like this:

{
    "telemetry.enableCrashReporter": true,
    "telemetry.enableTelemetry": true,
    "code-runner.enableAppInsights": false,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "python.languageServer": "Default",
    "terminal.integrated.detectLocale": "on",
    "cSpell.userWords": [
    ],
    "cSpell.language": "en-GB",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.shellArgs.windows": null,
    "workbench.colorTheme": "BrentonWL",
    "wolfram.semanticTokens": true,
    "wolfram.command": [
        "`kernel`",
        "-noinit",
        "-noprompt",
        "-nopaclet",
        "-noicon",
        "-nostartuppaclets",
        "-run",
        "Needs[\"LSPServer`\"];LSPServer`StartServer[]"
    ],
    "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?_",
    "[wolfram]": {
        "wolfram.kernel": "C:\\Program Files\\Wolfram Research\\Wolfram Engine\\13.1\\WolframKernel.exe",
        "wolfram.command": [
            "`kernel`",
            "-noinit",
            "-noprompt",
            "-nopaclet",
            "-noicon",
            "-nostartuppaclets",
            "-run",
            "Needs[\"LSPServer`\"];LSPServer`StartServer[]"
        ]
    },
    "wolfram.kernel": "C:\\Program Files\\Wolfram Research\\Wolfram Engine\\13.1\\WolframKernel.exe"
}

image

I'm not able to reproduce this.

It would be good to first collect some information about your setup.

Can you evaluate:

PacletFind /@ {"CodeParser", "CodeInspector", "CodeFormatter", "LSPServer"} 

and paste the result?

C:\>wolframscript -c "PacletFind /@ {\"CodeParser\", \"CodeInspector\", \"CodeFormatter\", \"LSPServer\"} "
{{PacletObject[<|Name -> CodeParser, Version -> 1.7.1, WolframVersion -> 12.1+, Description -> Parse Wolfram Language code., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Tue 30 Aug 2022 14:00:14, BuildNumber -> 1042, BuildWolframVersionNumber -> 1301, BuildWolframLibraryVersion -> 6, Transport -> MathLink, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> CodeParser`}, {Documentation, Language -> All, MainPage -> Guides/CodeParser}, {LibraryLink}, {Resource, Root -> Resources, Resources -> {{Collatz, Examples/Collatz.m}, {LongNames, Generated/LongNames.wl}, {Precedence, Generated/Precedence.wl}}}}, Location -> C:\Users\rodolfo.hermans\AppData\Roaming\WolframEngine\Paclets\Repository\CodeParser-1.7.1|>], PacletObject[<|Name -> CodeParser, Version -> 1.4, WolframVersion -> 12.1+, Description -> Parse Wolfram Language code., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Wed 08 Dec 2021 18:59:29, BuildNumber -> 573, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> CodeParser`}, {Documentation, Language -> All, MainPage -> Guides/CodeParser}, {LibraryLink}, {Resource, Root -> Resources, Resources -> {{Collatz, Examples/Collatz.m}, {LongNames, Generated/LongNames.wl}}}}, Location -> C:\Program Files\Wolfram Research\Wolfram Engine\13.0\SystemFiles\Components\CodeParser|>]}, {PacletObject[<|Name -> CodeInspector, Version -> 1.7, WolframVersion -> 12.1+, Description -> Find and report problems in Wolfram Language code., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Fri 01 Jul 2022 11:58:38, BuildNumber -> 383, BuildWolframVersionNumber -> 1301, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> CodeInspector`}, {FrontEnd, Root -> FrontEnd, Prepend -> True}, {Documentation, Language -> All, MainPage -> Guides/CodeInspector}, {Resource, Root -> Resources, Resources -> {{Collatz, Examples/Collatz.m}, {BadSymbols, Data/BadSymbols.wl}, {BuiltinFunctions, Data/BuiltinFunctions.wl}, {Constants, Data/Constants.wl}, {ExperimentalSymbols, Data/ExperimentalSymbols.wl}, {FreeCharacters, Data/FreeCharacters.wl}, {FreeLongNames, Data/FreeLongNames.wl}, {ObsoleteSymbols, Data/ObsoleteSymbols.wl}, {SessionSymbols, Data/SessionSymbols.wl}, {SystemCharacters, Data/SystemCharacters.wl}, {SystemLongNames, Data/SystemLongNames.wl}, {UndocumentedCharacters, Data/UndocumentedCharacters.wl}, {UndocumentedLongNames, Data/UndocumentedLongNames.wl}, {UndocumentedSymbols, Data/UndocumentedSymbols.wl}, {UnsupportedCharacters, Data/UnsupportedCharacters.wl}, {UnsupportedLongNames, Data/UnsupportedLongNames.wl}}}}, Location -> C:\Users\rodolfo.hermans\AppData\Roaming\WolframEngine\Paclets\Repository\CodeInspector-1.7|>], PacletObject[<|Name -> CodeInspector, Version -> 1.4, WolframVersion -> 12.1+, Description -> Find and report problems in Wolfram Language code., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Wed 08 Dec 2021 18:22:29, BuildNumber -> 183, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> CodeInspector`}, {FrontEnd, Root -> FrontEnd, Prepend -> True}, {Documentation, Language -> All, MainPage -> Guides/CodeInspector}, {Resource, Root -> Resources, Resources -> {{Collatz, Examples/Collatz.m}, {BadSymbols, Data/BadSymbols.wl}, {BuiltinFunctions, Data/BuiltinFunctions.wl}, {Constants, Data/Constants.wl}, {ExperimentalSymbols, Data/ExperimentalSymbols.wl}, {FreeCharacters, Data/FreeCharacters.wl}, {FreeLongNames, Data/FreeLongNames.wl}, {ObsoleteSymbols, Data/ObsoleteSymbols.wl}, {SessionSymbols, Data/SessionSymbols.wl}, {SystemCharacters, Data/SystemCharacters.wl}, {SystemLongNames, Data/SystemLongNames.wl}, {UndocumentedCharacters, Data/UndocumentedCharacters.wl}, {UndocumentedLongNames, Data/UndocumentedLongNames.wl}, {UndocumentedSymbols, Data/UndocumentedSymbols.wl}, {UnsupportedCharacters, Data/UnsupportedCharacters.wl}, {UnsupportedLongNames, Data/UnsupportedLongNames.wl}}}}, Location -> C:\Program Files\Wolfram Research\Wolfram Engine\13.0\SystemFiles\Components\CodeInspector|>]}, {PacletObject[<|Name -> CodeFormatter, Version -> 1.7, WolframVersion -> 12.1+, Description -> Format Wolfram Language code., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Fri 01 Jul 2022 13:03:52, BuildNumber -> 333, BuildWolframVersionNumber -> 1301, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> CodeFormatter`}, {FrontEnd, Root -> FrontEnd, Prepend -> True, WolframVersion -> 12.2+}, {Documentation, Language -> All, MainPage -> Guides/CodeFormatter}}, Location -> C:\Users\rodolfo.hermans\AppData\Roaming\WolframEngine\Paclets\Repository\CodeFormatter-1.7|>], PacletObject[<|Name -> CodeFormatter, Version -> 1.4, WolframVersion -> 12.1+, Description -> Format Wolfram Language code., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Wed 08 Dec 2021 21:19:45, BuildNumber -> 147, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> CodeFormatter`}, {FrontEnd, Root -> FrontEnd, Prepend -> True, WolframVersion -> 12.2+}, {Documentation, Language -> All, MainPage -> Guides/CodeFormatter}}, Location -> C:\Program Files\Wolfram Research\Wolfram Engine\13.0\SystemFiles\Components\CodeFormatter|>]}, {PacletObject[<|Name -> LSPServer, Version -> 1.7.1, WolframVersion -> 12.1+, Description -> Language Server Protocol implementation for Wolfram Language., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Tue 30 Aug 2022 13:57:46, BuildNumber -> 102, BuildWolframVersionNumber -> 1301, BuildWolframLibraryVersion -> 6, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> LSPServer`}, {Documentation, Language -> All, MainPage -> Guides/LSPServer}, {LibraryLink}, {Resource, Root -> Resources, Resources -> {{BuiltinFunctions, Data/BuiltinFunctions.wl}, {Constants, Data/Constants.wl}, {ExperimentalSymbols, Data/ExperimentalSymbols.wl}, {FreeCharacters, Data/FreeCharacters.wl}, {FreeLongNames, Data/FreeLongNames.wl}, {ObsoleteSymbols, Data/ObsoleteSymbols.wl}, {SystemCharacters, Data/SystemCharacters.wl}, {SystemLongNames, Data/SystemLongNames.wl}, {UndocumentedCharacters, Data/UndocumentedCharacters.wl}, {UndocumentedLongNames, Data/UndocumentedLongNames.wl}, {UndocumentedSymbols, Data/UndocumentedSymbols.wl}, {UnsupportedCharacters, Data/UnsupportedCharacters.wl}, {UnsupportedLongNames, Data/UnsupportedLongNames.wl}}}}, Location -> C:\Users\rodolfo.hermans\AppData\Roaming\WolframEngine\Paclets\Repository\LSPServer-1.7.1|>], PacletObject[<|Name -> LSPServer, Version -> 1.4, WolframVersion -> 12.1+, Description -> Language Server Protocol implementation for Wolfram Language., Creator -> Brenton Bostick <brenton@wolfram.com>, BuildDate -> Wed 08 Dec 2021 20:28:41, BuildNumber -> 543, Updating -> Automatic, Extensions -> {{Kernel, Root -> Kernel, Context -> LSPServer`}, {Documentation, Language -> All, MainPage -> Guides/LSPServer}, {LibraryLink}, {Resource, Root -> Resources, Resources -> {{BuiltinFunctions, Data/BuiltinFunctions.wl}, {Constants, Data/Constants.wl}, {ExperimentalSymbols, Data/ExperimentalSymbols.wl}, {FreeCharacters, Data/FreeCharacters.wl}, {FreeLongNames, Data/FreeLongNames.wl}, {ObsoleteSymbols, Data/ObsoleteSymbols.wl}, {SystemCharacters, Data/SystemCharacters.wl}, {SystemLongNames, Data/SystemLongNames.wl}, {UndocumentedCharacters, Data/UndocumentedCharacters.wl}, {UndocumentedLongNames, Data/UndocumentedLongNames.wl}, {UndocumentedSymbols, Data/UndocumentedSymbols.wl}, {UnsupportedCharacters, Data/UnsupportedCharacters.wl}, {UnsupportedLongNames, Data/UnsupportedLongNames.wl}}}}, Location -> C:\Program Files\Wolfram Research\Wolfram Engine\13.0\SystemFiles\Components\LSPServer|>]}}

C:\>

sigh

OK, running wolframscript may be giving a different result than the WolframKernel.exe in your command (and the pasted result is huge and unreadable).

Please start the WolframKernel.exe that you specified in the command and evaluate

PacletFind /@ {"CodeParser", "CodeInspector", "CodeFormatter", "LSPServer"}

and paste the result.

I'm interested in what the kernel that you want to use is doing.

I would also like the versions of VSCode itself and the Wolfram extension that you are using.

You can find the VSCode version by going to Help > About

You can find the Wolfram extension version by going to Extensions button on far left-side, going to your Installed extensions, finding Wolfram Language, clicking on it

I have some questions and other things to try:

Has this ever worked? Or did it recently stop working?

Do you ever run multiple kernels? There may be stray kernel processes that are still running and you are hitting a license limit.

Do you have different users on the machine? Could there be a permissions problem?

Assuming that are running everything as the user rodolfo.hermans, check and see if the directory C:\Users\rodolfo.hermans\AppData\Local\Temp\Wolfram-LSPServer exists.

This is something that I suggest for people to run when the kernel is crashing, and I do not think it will be very useful here, but I would just like to get more information.

Start the WolframKernel.exe that you specified in the command and evaluate:

Needs["LSPServer`"]
LSPServer`RunServerDiagnostic[{"C:\\Program Files\\Wolfram Research\\Wolfram Engine\\13.1\\WolframKernel.exe", "-noinit", "-noprompt", "-nopaclet", "-noicon", "-nostartuppaclets", "-run", "Needs[\"LSPServer`\"];LSPServer`StartServer[]"}]

and paste the result.

Maybe there will be something useful here.

Wolfram Language 13.1.0 Engine for Microsoft Windows (64-bit)
Copyright 1988-2022 Wolfram Research, Inc.

In[1]:= Needs["LSPServer`"]

In[2]:= LSPServer`RunServerDiagnostic[{"C:\\Program Files\\Wolfram Research\\Wolfram Engine\\13.1\\WolframKernel.exe", "-noinit", "-noprompt", "-nopaclet", "-noicon", "-nostartuppaclets", "-run", "Needs[\"LSPServer`\"];LSPServer`StartServer[]"}]
Running Language Server diagnostic...

IMPORTANT: Make sure that all other kernels are shut down before running this diagnostic.
Transient license limit errors may give false negatives.

INFORMATION: Host Kernel: C:\Program Files\Wolfram Research\Wolfram Engine\13.1\WolframKernel.exe
INFORMATION: Host Kernel version: 13.0
INFORMATION: Host Kernel Directory[]: C:\Program Files\Wolfram Research\Wolfram Engine\13.1
INFORMATION: Host Kernel $MaxLicenseProcesses: 2
INFORMATION: Host Kernel LSPServer version: 1.7.1
INFORMATION: Host Kernel CodeParser version: 1.7.1
INFORMATION: Host Kernel CodeInspector version: 1.7
INFORMATION: Host Kernel CodeFormatter version: 1.7
INFORMATION: Host Kernel LSPServer build date: Tue 30 Aug 2022 13:57:46
INFORMATION: Host Kernel CodeParser build date: Tue 30 Aug 2022 14:00:14
INFORMATION: Host Kernel CodeInspector build date: Fri 01 Jul 2022 11:58:38
INFORMATION: Host Kernel CodeFormatter build date: Fri 01 Jul 2022 13:03:52

Start Stage 1
Checking whether bug 410895 is present and work-around is needed...
Starting Mini Server kernel with command: 
 
>   {C:\Program Files\Wolfram Research\Wolfram Engine\13.1\WolframKernel.exe, -noinit, -noprompt, 
 
>    -nopaclet, -noicon, -nostartuppaclets, -run, 
 
>    Test410895[(*"*)];ToExpression[FromCharacterCode[{78, 101, 101, 100, 115, 91, 34, 76, 83, 80, 83,\
 
>     101, 114, 118, 101, 114, 96, 34, 93, 59, 76, 83, 80, 83, 101, 114, 118, 101, 114, 96, 83, 101,\
 
>     114, 118, 101, 114, 68, 105, 97, 103, 110, 111, 115, 116, 105, 99, 115, 96, 83, 116, 97, 114,\
 
>     116, 77, 105, 110, 105, 83, 101, 114, 118, 101, 114, 91, 93}]]}
Waiting maximum of 30 seconds for any hangs.
Sanity checking...
Sanity check was successful.
Testing bug 410895...
double-quotes are kept; bug 410895 is NOT present; NO work-around needed
Testing bug 410895 was successful.
Exiting...
waiting 2 seconds for exit...
Exiting was successful.
INFO: Exit code: 0
Done Stage 1

Start Stage 2
Now running actual diagnostics...
$WorkaroundBug410895: False
Starting Language Server kernel with command: 
 
>   {C:\Program Files\Wolfram Research\Wolfram Engine\13.1\WolframKernel.exe, -noinit, -noprompt, 
 
>    -nopaclet, -noicon, -nostartuppaclets, -run, Needs["LSPServer`"];LSPServer`StartServer[]}
Waiting maximum of 30 seconds for any hangs.
Writing initialize message...
initialize message was successful.
Writing diagnostics message...
INFORMATION: Server Kernel: C:\Program Files\Wolfram Research\Wolfram Engine\13.1\WolframKernel.exe
INFORMATION: Server Kernel $CommandLine //InputForm: 
 
>   {"C:\\Program Files\\Wolfram Research\\Wolfram Engine\\13.1\\WolframKernel.exe", "-noinit", 
 
>    "-noprompt", "-nopaclet", "-noicon", "-nostartuppaclets", "-run", 
 
>    "Needs[\"LSPServer`\"];LSPServer`StartServer[]"}
INFORMATION: Server Kernel Directory[]: C:\Program Files\Wolfram Research\Wolfram Engine\13.1
INFORMATION: Server Kernel $VersionNumber: 13.0
INFORMATION: Server Kernel $MaxLicenseProcesses: 2
INFORMATION: Server Kernel LSPServer version: 1.7.1
INFORMATION: Server Kernel CodeParser version: 1.7.1
INFORMATION: Server Kernel CodeInspector version: 1.7
INFORMATION: Server Kernel CodeFormatter version: 1.7
INFORMATION: Server Kernel LSPServer build date: Tue 30 Aug 2022 13:57:46
INFORMATION: Server Kernel CodeParser build date: Tue 30 Aug 2022 14:00:14
INFORMATION: Server Kernel CodeInspector build date: Fri 01 Jul 2022 11:58:38
INFORMATION: Server Kernel CodeFormatter build date: Fri 01 Jul 2022 13:03:52
diagnostics message was successful.
Writing shutdown message...
shutdown message was successful.
Writing exit message...
waiting 2 seconds for exit...
exit message was successful.
INFO: Time to initialize server: 5.5287 seconds
INFO: Exit code: 0
Done Stage 2

No problems found.

In[3]:= 

image


In[3]:= PacletFind /@ {"CodeParser", "CodeInspector", "CodeFormatter", "LSPServer"}

Out[3]= {{PacletObject[CodeParser, 1.7.1, <>], PacletObject[CodeParser, 1.6, <>]}, 
 
>    {PacletObject[CodeInspector, 1.7, <>], PacletObject[CodeInspector, 1.6, <>]}, 
 
>    {PacletObject[CodeFormatter, 1.7, <>], PacletObject[CodeFormatter, 1.6, <>]}, 
 
>    {PacletObject[LSPServer, 1.7.1, <>], PacletObject[LSPServer, 1.6, <>]}}

In[4]:= 

VS Code 1.72.1
image

Extension v1.7.0
image

Has this ever worked?
No, never worked

Do you ever run multiple kernels? There may be stray kernel processes that are still running and you are hitting a license limit.
I am aware of that problem, but I have tried after restarting without opening other kernels before testing the VS Code extension.

Do you have different users on the machine? Could there be a permissions problem?
I do not have Administrator privileges in this Machine, no other users are concretely logged in.

C:\Users\rodolfo.hermans\AppData\Local\Temp\Wolfram-LSPServer folder exists but it's empty

Thank you for all of the info, and thank you for trying all of these suggestions.

We will get to the bottom of this.

You do have the latest versions of everything, so nothing to fix there.

The diagnostics did not find anything.

The fact that Wolfram-LSPServer directory means that the VSCode side of things is working.

If you are willing, the next I'd like to try is to turn on some debugging in the kernel and see if anything useful is logged.

In your settings.json, please modify the "wolfram.command" entry (and you can remove the "[wolfram]" entry)

Change it to this, and restart VSCode and try again:

"wolfram.command": [
        "`kernel`",
        "-noinit",
        "-noprompt",
        "-nopaclet",
        "-nostartuppaclets",
        "-noicon",
        "-run",
        "Needs[\"LSPServer`\"];LSPServer`$Debug2=True;LSPServer`StartServer[\"C:/Users/rodolfo.hermans/AppData/Local/Temp/Wolfram-LSPServer\"]"
    ]

With any luck, after you restart and try, there will be a log file with some contents in that directory.

Let me know whether or not there is a log file, and paste its contents here.

Thanks for all your help. With the example code...

Which[a, b, a, b]

image

Now it works... but

image

Where do I find the log file?

This if how the settings.json file looks like now

{
    "telemetry.enableCrashReporter": true,
    "telemetry.enableTelemetry": true,
    "code-runner.enableAppInsights": false,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "python.languageServer": "Default",
    "terminal.integrated.detectLocale": "on",
    "cSpell.userWords": [
    ],
    "cSpell.language": "en-GB",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.shellArgs.windows": null,
    "workbench.colorTheme": "BrentonWL",
    "wolfram.semanticTokens": true,
    "wolfram.command": [
    
        "`kernel`",
        "-noinit",
        "-noprompt",
        "-nopaclet",
        "-nostartuppaclets",
        "-noicon",
        "-run",
        "Needs[\"LSPServer`\"];LSPServer`$Debug2=True;LSPServer`StartServer[\"C:/Users/rodolfo.hermans/AppData/Local/Temp/Wolfram-LSPServer\"]"
    ],
    "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?_",
    "wolfram.kernel": "C:\\Program Files\\Wolfram Research\\Wolfram Engine\\13.1\\WolframKernel.exe",
    "wolframLanguageNotebook.kernel.configurations": {
    
        "wolframscript": {
            "type": "local",
            "command": "wolframscript",
            "ports": "49152-65535"
        }
    },
    "cmake.configureOnOpen": false
}

Interesting. I don't understand why the latest changes would allow it to start working, but I'm glad it did!

I was not previously aware that you were also working with the "Wolfram Language Notebook" extension.

We (Wolfram Research) do not manage the "Wolfram Language Notebook" extension. I'm sure the developer will be able to help.