How do set Julia version in VSCode when using juliaup

I am using Juliaup to manage my Julai version. It is now using the 1.10 beta by default. However, for one application, I need to quickly run something in 1.9. I almost exclusively use VSCode.

Is there a way, when using Juliaup, to start a VSCode session using a specific Julai version? I guess I could reconfigure Juliaup to change its default, but I am also running other julia sessions, so it would be neat if there is a way to simply tell VSCode “use this version” (like I can do with e.g. a Jupyter notebook in VSCode).

Not exactly what you want, but running:

juliaup default 1.9

in the command line before opening VS Code should do the trick.

UPDATE: this doesn’t work, see: How do set Julia version in VSCode when using juliaup - #8 by davidanthoff

1 Like

There is

julia.executablePath

in the settings of the VSCode Julia extension.
You can set it, e.g. to:

c:\Users\oheil\.julia\juliaup\julia-1.10.0-beta2+0.x64.w64.mingw32\bin\julia.exe

Choose your path to your desired Julia executable. My example is for Windows.

1 Like

Does this work for JuliaUp though? EIther case, it seems like I would have to go in, change the executive file, and then start VSCode, and then change it again?

Yeah, this would work, but feels like there might be something more convenient (just like juliaup lets you star ta Julia session without changing the default).

In my example I choose a specific juliaup installed executable.

You can start a specific version also with, e.g.

julia +1.10

but I don’t know if this is somehow configurable in VSCode in a convenient way.

1 Like

Ok, yeah, that make sense now, sorry for the confusion!

So, I think setting julia.executablePath to something like julia +1.9 should work.

What does not work (but really should) is that the VS Code extension picks up Juliaup directory overrides or the env var. That is a bit of a shame, and I hope to fix that sometime soon.

5 Likes

Ok, at least good to know. Hopefully some neater interface for these appear some time down the line :slight_smile:

1 Like

Slight improvement: I update juliaup default and then I reload the VSCode window from the command palette

1 Like

Yeah, that’s what I have been doing as well. However, that requires me to then reset the default for when I need to restart my other julia sessions (which I run in my standard environment). And then when I need to restart this julai session I have to run through it all as well.

It works, but it is a bit of a mess to keep track of.

1 Like

What worked for me is using the shell to enter the correct version, and installing any package. This creates an environment which vscode should be able to detect once you reload.

1 Like