Vscode No server install found in WSL, needs x64

When I just opened a new WSL2 Ubuntu 20.04 terminal and ran code . to launch the VSCode editor it fa ...

github.com

まだ根本的な解決にはたどり着いていないようですが、

結論的には、VS Codeを立ち上げて左下の(><)をクリックします。

Vscode No server install found in WSL, needs x64

再度リモートでWSLに接続するとVS Code Serverがインストールされます。

私の場合はもともとWSLに接続され状態だったのでこの作業は必要とせず勝手にインストールされました。

 

 

  • Twitter
  • Share
  • Hatena

-開発
-VS Code, WSL2

author

関連記事

Vscode No server install found in WSL, needs x64
私はVS CodeでGithubにpullしたいだけなんです。

はじめに 私はVS CodeでGithubにpullしたいだけなんです。 ただそれだけなんです。 ということで、VS CodeでGithubでpullする最短コース(?)です。 インストールから設定し ...

開発

Vscode No server install found in WSL, needs x64
[Tips] VSCode(with WSL2)でAzure Virtual Machinesの拡張機能が有効にならない

Tips VSCode(with WSL2)でAzure Virtual Machinesの拡張機能が有効にならないのはWSL2特有の問題です。 早く解決されないかなぁ。

開発

Vscode No server install found in WSL, needs x64
私はVS CodeでGithubにPull Requestしたいだけなんです。

はじめに 私はVS CodeでGithubにPull Requestしたいだけなんです。 ただそれだけなんです。 ということで、VS CodeでGithubでPull Requestする最短コース(? ...

Vscode No server install found in WSL, needs x64

Florian Kromer

Follow

May 30, 2021

·

4 min read

·

Member-only

VSCode in WSL2-Ubuntu

How to setup VSCode in Ubuntu 20.04 LTS run with WSL2 on Windows 10.

Vscode No server install found in WSL, needs x64

Prerequisite check

With the WSL extension installed, you will see a new Status bar item at the far left.

Vscode No server install found in WSL, needs x64

The Remote Status bar item can quickly show you in which context VS Code is running (local or remote) and clicking on the item will bring up the WSL extension commands.

Vscode No server install found in WSL, needs x64

Enable WSL

Windows Subsystem for Linux (WSL) is an optional feature on Windows 10. You can enable it through the Windows Features dialog or PowerShell.

Windows Features dialog

In the Windows search bar, type 'features' to bring up the Turn Windows Features on and off dialog. Scroll down and check Windows Subsystem for Linux.

Vscode No server install found in WSL, needs x64

Select OK and you will be prompted to restart Windows.

PowerShell

If you prefer, you can open PowerShell as an Administrator and type:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

After the command runs, you will be prompted to restart Windows.

Vscode No server install found in WSL, needs x64

Check WSL

After restarting Windows, you can check that you have WSL enabled by opening a Command Prompt and typing 'wsl'.

Vscode No server install found in WSL, needs x64

WSL is enabled, but you haven't installed a Linux distribution yet.

Install a Linux distro

You install Linux distributions for WSL from the Microsoft Store. You can use the store app, or search for a Linux distro in the Windows search bar. Choose the Linux distribution you want to install (for example Ubuntu) and follow the prompts.

Vscode No server install found in WSL, needs x64

Select Install.

Vscode No server install found in WSL, needs x64

And when done, select Launch to get started. This will open a Linux terminal and complete the installation. You'll need to create a user ID and password since you are setting up a full Linux instance. You are now running Linux on Windows.

Vscode No server install found in WSL, needs x64

Python development

If you don't have Python already installed, run the following commands to install Python3 and pip, the package manager for Python, into your Linux installation.

sudo apt update
sudo apt install python3 python3-pip

And to verify, run:

python3 --version

Start with the canonical "Hello World" app. Create a new folder called "helloWorld" and then add a Python file that will print a message when run:

mkdir helloWorld && cd helloWorld
echo 'print("hello from python on ubuntu on windows!")' >> hello.py
python3 hello.py

In a remote Linux environment (this WSL distro is technically another machine without UI, that just happens to be running locally on your computer), your development tools and experiences are pretty limited. You can run Vim in the terminal to edit your file, or you can edit the sources on the Windows side through the \\wsl$ mount:

Vscode No server install found in WSL, needs x64

The problem with this model is that the Python runtime, pip, or any conda packages for that matter, are not installed on Windows.

Vscode No server install found in WSL, needs x64

Remember, Python is installed in the Linux distro, which means if you're editing Python files on the Windows side, you can't run or debug them unless you install the same Python development stack on Windows. And that defeats the purpose of having an isolated Linux instance set up with all your Python tools and runtimes!

Run in WSL

In the WSL terminal, make sure you are in the helloWorld folder, and type in 'code .' to launch Visual Studio Code. The '.' argument tells VS Code to open the current folder. If you use the Insiders version of VS Code, you will have to run 'code-insiders .' instead.

Note: If this command does not work, you may need to restart your terminal, or you may not have added VS Code to your path when it was installed.

Vscode No server install found in WSL, needs x64

The first thing you'll see is a message about "Installing VS Code Server" (the c7d83e57… number is the version of the VS Code Server that matches the client-side tools you just installed). VS Code is installing a small server on the Linux side that the desktop VS Code will then talk to. That server will then install and host extensions in WSL, so that they run in the context of the tools and frameworks installed in WSL. In other words, your language extensions will run against the tools and frameworks installed in WSL, not against what is installed on the Windows side, as it should for the proper development experience.

The next thing that happens is VS Code will start and open the helloWorld folder. You may see a quick notification telling you that VS Code is connecting to WSL, and you may be prompted to allow access to the Node.js-based server.

Vscode No server install found in WSL, needs x64

Now, when you hover over hello.py, you get the proper Linux path.

Vscode No server install found in WSL, needs x64

Integrated Terminal

Run Terminal > New Terminal (⌃` (Windows, Linux Ctrl+`)) to open a new terminal instance.

Vscode No server install found in WSL, needs x64

You'll start a new instance of the bash shell in WSL, again from VS Code running on Windows.

Tip: In the lower left corner of the Status Bar, you can see that you're connected to your WSL: Ubuntu instance.

Vscode No server install found in WSL, needs x64

Edit and debug

Installing the Python extension (and additional tools)

Click on hello.py to open it for editing. You will be prompted with an extension recommendation, in this case to install the Microsoft Python extension, which will give you rich editing and debugging experiences. Go ahead and select Install and reload if prompted.

Vscode No server install found in WSL, needs x64

To prove that the extension is installed in WSL, open the Extensions view again (⇧⌘X (Windows, Linux Ctrl+Shift+X)). You will see a section titled WSL: Ubuntu – Installed, and you can see any extensions that are installed on the WSL side.

Vscode No server install found in WSL, needs x64

Upon reload, you'll also get prompted telling you that the pylint linter is not installed. Linters are used to show errors and warnings in source code. Go ahead and select Install.

Vscode No server install found in WSL, needs x64

Now, when you edit your code, you get rich colorization and completions.

Vscode No server install found in WSL, needs x64

And when you save your file (⌘S (Windows, Linux Ctrl+S)), you'll get linting errors and warnings on the file.

Vscode No server install found in WSL, needs x64

Debugging

With your tools set up, let's take this one step further. Set a breakpoint on line 1 of hello.py by clicking in the gutter to the left of the line number or by putting the cursor on the line and pressing F9.

Vscode No server install found in WSL, needs x64

Now, press F5 to run your application. You will be asked how to run the application, and since this is a simple file, just choose Python File.

Vscode No server install found in WSL, needs x64

The app will start, and you'll hit the breakpoint. You can inspect variables, create watches, and navigate the call stack.

Press F10 to step and you'll see the output of the print statement in the debug console.

Vscode No server install found in WSL, needs x64

You get the full development experience of Visual Studio Code, using the Linux instance installed in WSL.

If you want to open another folder in WSL, open the File menu and choose Open Folder. You'll get a minimal file and folder navigator for the Linux file system, not the Windows file system.

Vscode No server install found in WSL, needs x64

If you want to switch back to the Windows, select the Show Local option and you'll get the standard Windows File Open dialog.

Ending your WSL connection

You can end your session in WSL and go back to running VS Code locally with File > Close Remote Connection.

How to install VS Code in WSL?

Install VS Code and the WSL extension. Visit the VS Code install page and select the 32 or 64 bit installer. ... .
Update your Linux distribution. ... .
Open a WSL project in Visual Studio Code. ... .
Extensions inside of VS Code WSL. ... .
Install Git (optional) ... .
Install Windows Terminal (optional) ... .
Additional Resources..

Does Visual Studio work with WSL?

Visual Studio's WSL 2 toolset allows you to use Visual Studio to build and debug C++ code on WSL 2 distros without adding a SSH connection. You can already build and debug C++ code on WSL 1 distros using the native WSL 1 toolset introduced in Visual Studio 2019 version 16.1.

Can you use WSL in VS Code?

To get started with using WSL in VS Code, you'll need to download the WSL extension from the Extension Marketplace. You'll also need WSL and a Linux distribution installed. We recommend using WSL 2, which is the newest version of WSL, as you will benefit from significant performance advantages over WSL 1.

How do I enable Windows Subsystem for Linux in Windows 10?

Install WSL command Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting "Run as administrator", enter the wsl --install command, then restart your machine. This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux.