Python-language-server: "Connection to [Python language ] server is erroring. Shutting down."

Created on 12 Dec 2018  Â·  22Comments  Â·  Source: microsoft/python-language-server

@WritingSolutions2020 commented on Tue Dec 11 2018

Environment data

  • VS Code version: 1.29.1
  • Extension version: ms-python.python-2018.11.0, languageServer.0.1.66
  • OS and version: Linux 4.15.0-42-generic #45~16.04.1-Ubuntu SMP, i686 i686 GNU/Linux
  • Python version: 3.5.2
  • Type of virtual environment used: N/A
  • Relevant/affected Python packages and their versions: N/A?

Expected behaviour

VSCode 1.29.1 loads the Python Language Server without error. This was the behavior until yesterday afternoon.

Actual behaviour

As of yesterday afternoon, VSCode began reporting multiple errors, shuts down language server. See Logs, below.

Steps to reproduce:

  1. In VSCode, open a Python 3 source file. (First line of PY files specifies Python 3: #!/usr/bin/python3).

Logs (from Output tab):

Starting Microsoft Python language server.
[Error - 2:05:51 PM] Connection to server is erroring. Shutting down server.
[Error - 2:05:51 PM] Connection to server is erroring. Shutting down server.
[Error - 2:05:51 PM] Connection to server is erroring. Shutting down server.
/home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: 1:
/home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: cannot open �xo3���J�������: No such file
/home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: 1: 
/home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: ELF: not found
/home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: 2: 
/home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: Syntax error: word unexpected (expecting ")")
  1. Per Logs, above, each occurrence creates a file that it cannot open: �xo3���J�������. This is a zero-bytes file that Caja lists as ��@@ (invalid encoding). After each occurrence, I open the Python project folder then delete that file.

  2. Attempt to use the information in the following pages to correct the problem:

  1. Upon restart, VSCode reports:
Starting Microsoft Python language server.
Downloading https://pvsc.azureedge.net/python-language-server-stable/Python-Language-Server-linux-x64.0.1.66.nupkg...

After download, the error occurs as initially described in this GitHub issue.

  1. Per this GitHub issue, https://github.com/Microsoft/vscode-python/issues/2490, download then reinstall code_1.29.1-1542309226_i386.deb.

Error remains as initially described.


This error occurred for the first time yesterday afternoon. Before that everything worked well. I haven't made any changes to that previously working configuration...(?)

All 22 comments

I don't think this is an issue with the language server. That message is printed from the LS client lib in the extension: https://github.com/Microsoft/vscode-languageserver-node/blob/0cc3b8a89747a72eb431f35e06990a6e217021bb/client/src/client.ts#L2995-L3001

The bit of the error that says:

�ELF����: not found

Makes it look like our binary is being interpreted instead of executed as a binary, and then the following message of:

Syntax error: word unexpected (expecting ")")

Comes from dash when it is interpreting a shell script and hits a syntax error (rightfully, because it's a binary executable).

To me it looks like there's some extraction problem or issue in the environment when starting the server. It hasn't gotten to the point where our code executes yet.

@WritingSolutions2020 Can you run:

$ file /home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer

And give the output? What happens when you just run the binary from your terminal, i.e.:

$ /home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer

_@WritingSolutions2020 Can you run:_...

  1. In BASH, ran file /home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer.

Response ==

/home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=fe8d4f7a3c99786f33aedefe4ae70482b3e3df15, stripped
  1. In BASH, ran exec /home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer

NOTE: I needed to preface the path with exec or the response was only the first of the following two lines (cannot execute binary file: Exec format error).

Response ==

bash: /home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: cannot execute binary file: Exec format error
bash: /home/rbv/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66/Microsoft.Python.LanguageServer: Success

This may not be pertinent or helpful, BUT I'll add that one of the annoyances is that VSCode keeps trying to use Python 2 unless I make the first line of a PY file == #!/usr/bin/python3.

I mention this because the line in the Output panel == Syntax error: word unexpected (expecting ")") reminds me of a similar, but not identical, message that I receive if I don't insert the #!... line. In that case it's usually because Python 2 stumbles over the parentheses in a Python 3 print() statement. This isn't of course an issue with print() but thought I'd mention the similarity lest it be helpful...

How the extension chooses the interpreter to use has nothing to do with the shebang (the #! line). You would need to use the interpreter menu to select which interpreter you want the editor to use. In any case, your shebang is not what is causing this problem.

I should have looked more carefully at your initial report, as the issue here is that you're running an i686 system, but the language server is only compiled for 64-bit Linux. That's why executing the language server fails; it isn't compiled to run on 32-bit systems.

Because the language server is a C# application using .NET Core, we are limited by what they support, and the only 32-bit OS they support is Windows (https://github.com/dotnet/core/blob/master/release-notes/2.2/2.2-supported-os.md), which means that we cannot support 32-bit Linux.

If you'd like to use the language server, you're going to have to move to a 64-bit build of Linux. You should still be able to use Jedi in the VS Code Python extension, either way, as it is itself written in Python and is not bound to any specific platform (so long as Python exists there).

@brettcannon - I thought the extension performs basic check of the platform and should reject 32-bit OS (Including Windows). Did it get broken?

@jakebailey OK -- disappointing because it was evidently working until a couple of days ago(?)

Regardless, how do I get the language server out of the picture? Remove the Python extension entirely? Or?

In your VS Code settings, change "Jedi Enabled" to true (searching for "Jedi" will find it), or in the JSON directly:

"python.jediEnabled": true

Sorry, true, not false. Copied from my own config without changing it, oops.

@jakebailey

It seems I'm stuck in a deadly-embrace loop.

  1. I've gone everywhere I can find in both the GUI and the JSON config files to set python.jediEnabled to false. But when I open a PY file, Output reports the same error.

  2. I deleted language server directory ~/.vscode/extensions/ms-python.python-2018.11.0/languageServer.0.1.66. But when I open a PY file, VSCode wants to reload the language server.

It seems to have become a zombie I can't kill. At this point I fell like I need to kill Python support entirely to stop it attacking my editor...

You need to set it to true, not false. You want Jedi enabled, not disabled. I previously made a typo (which I corrected and followed up about).

screen shot 2018-12-12 at 3 54 05 pm

Thanks for your help -- and patience...

What I ended up having to do was [stuff]-canning IntelliSense entirely.

If I did not, then when I started VSCode a message at the bottom-right of the editor told me that IntelliSense required the Microsoft Language Server.

So I'm just throwing IntelliSense away for the time being. This is wayyy too many annoyances just to edit some Python 3 files...

I'm assuming you mean Intellicode, which does require the language server. "Intellisense" is synonymous with "completion". Intellicode is a separate extension which uses AI models to suggest different completion items over others, and is not required to use Python in VS Code.

@MikhailArkhipov we tightened the check up recently, but the syntax error bit mislead me to thinking it was something else other than a problem launching since the output suggests _something_ was executing.

I have the same problem. Have you found a solution?

@manolosolalinde - what problem specifically? LS does not run on some platforms, like older OS X. The extension is supposed to check that and block the launch.

Hi, thanks for answering. The error might just not be the same but if you let me I'll explain it anyway.

Now, here is my specific problem: Everytime I set "python.jediEnabled": true the window reloads and i get the following error:
intellicode
So I click "Enable it and Reload Window"
The window reloads and when I check the settings I get: "python.jediEnabled": false,
and I'm back where I started.

I'm running ubuntu 18.04. Here are some details regarding my OS:
$ uname -r Response---> 4.15.0-45-generic
$ uname -m Response---> x86_64
$ lsb_release -a
Response:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

Do you see language server downloading/startup messages?

I guess not. Nothing else happens besides that.

Yes

If you go to the extension folder (use Open Extensions Folder in VSC command palette) and try running Microsoft.Python.LanguageServer executable from console, what happens?

So I'm running:
$ exec ./ms-python.python-2019.1.0/languageServer.0.1.78/Microsoft.Python.LanguageServer
from the extension folder and I get no response. (Is that what you meant?)
It just hangs there.

ls_problem

Please note that there are 2 extension folders:
ms-python.python-2019.1.0
ms-python.python-2019.2.5433
Same happens with both.

Was this page helpful?
0 / 5 - 0 ratings