Last updated: Apr 6, 2024
Reading time·2 min
To solve the VSCode "Python Jedi client: couldn't create connection to Server"
error, set the python.languageServer
setting to Pylance
in your
settings.json
config file.
This is necessary because, in more recent versions of VS Code, Pylance is the default language server.
Ctrl
+ Shift
+ P
(or Command
+ Shift
+ P
on macOS).F1
to open the Command Palette.Type user settings json.
Click on Preferences: Open User Settings (JSON)
The command directly opens your settings.json
file.
settings.json
file."python.languageServer": "Pylance"
Once you add the line, restart VS Code and make sure you have the Pylance extension installed.
Ctrl
+ Shift
+ X
on Windows or Linux.Command
+ Shift
+ X
on macOS.If that doesn't work, you can try to set your python.languageServer
to
"Default"
.
"python.languageServer": "Default"
settings.json
You can also set your Python Language Server in your local settings.json
file.
In the root directory of your project, create a .vscode
folder.
Create a settings.json
file in the .vscode
folder.
Add the following code to your settings.json
file.
{ "python.languageServer": "Pylance" }
The settings that you've added to your local settings.json
file overwrite any
global configuration and only apply to the current project.
If that doesn't work, you can try to set your python.languageServer
to
"Default"
.
"python.languageServer": "Default"
If the error persists, try to uninstall the Pylance extension and then reinstall it.
Once you've uninstalled the extension, click on the Install button to reinstall it.
Restart VS Code.
If that didn't work either, try to delete the Pylance extension files manually.
extension
folder, search for pylance
and delete all
folders whose name contains "pylance"
.You can learn more about the related topics by checking out the following tutorials: