Can I use julia from Windows Subsystem for Linux in VS Code Julia Extension

Hello there,

Is there a way to make the julia vscode extension use the julia from the WSL? I have already setup the integrated terminal so that it opens the zsh in the WSL Ubuntu, but the julia extension seems to find only the windows julia.

TIA,

Rodrigo

Yes, this is how my workflow is setup. First, obviously install Julia on WSL2 and make sure your julia binary is in PATH. I would also get rid of your Windows Julia installation as to avoid any conflicts. From the vscode side (assuming its installed on windows), simply download the WSL extension and configure it (basically just open up a folder on your WSL 2 instance). Once you have vscode successfully configured with WSL2, download the Julia extension. Make sure to install this julia extension on the "remote " instance of vscode – see my image example below. This should pretty much be it.

Here’s how my extensions look like in VS Code:

7 Likes

It worked like a charm. Thank you very much!

Best,

Rodrigo

Thanks for the solution @affans!
Now I need to take it a step further.

From a laptop at work, I need to remotely use Julia on WSL2 on my Windows desktop at home.
I’ve managed to set the integrated terminal to use bash (WSL Ubuntu) when using Remote - SSH, but the Julia extension is searching for the executable on the Windows side.

The julia binary is in PATH (/mnt/c/Users/elias/Software/julia-1.5.3/bin) on WSL, but I haven’t done the same on the Windows side.

How should I approach this? Can I configure which platform (WSL vs Windows) the Julia extension is run on when using Remote - SSH?

The issue was that the default shell for OpenSSH wasn’t configured properly (the VS code extension still used CMD instead of bash after connecting to the server). Apparently, setting RemoteCommand bash in .ssh/config is not enough :man_facepalming:

I resolved the issue by following these instructions. They are inspired by this short blog post, which is worth a read.


TL;DR: Run

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force

in a Powershell session on the Windows server.