Vscode with ssh environment variables

When running vscode over ssh, loading the julia REPL loads julia-1.3, but I would like to use julia 1.4. This is presumably because ENV["PATH"] for the REPL only contains /julia-1.3.1/bin. But I don’t know where that PATH environment variable comes from. My .bashrc and .profile are both pointing to julia 1.4, and when I open a terminal inside vscode over ssh, the PATH contains both 1.4 and 1.3 (but 1.4 is first, so julia runs julia-1.4). And when I do plain ssh outside of vscode, only 1.4 is in the PATH.

I think there are some VS Code settings that one can use to add things to env vars. Here is one theory: you have that configured to add /julia-1.3.1/bin to your PATH. Your bash profiles are adding Julia 1.4 to the PATH. When you start a plain terminal in VS Code, you therefor end up with both in the PATH. But when you start a Julia REPL in VS Code, it starts it directly, not inside a shell. So whatever you have configured in your bash stuff doesn’t apply, but any VS Code setting would still affect things.

1 Like

The mystery is how it found /julia-1.3.1 in the first place, over ssh. I assumed it would just run julia. I tried uninstalling and reinstalling, to no avail.

Found a solution: it turns out that the settings for running over ssh are in a separate settings.json file on the remote machine (as you would expect). But when you go through Language Specific Settings, there’s no way to get to that file. You have to use Settings -> Remote [SSH: ...] tag -> Extensions -> Julia -> Edit in settings.json, then you can specify the path in "julia.executablePath": "/..."

1 Like