How to change Julia version in VSCode?

I have a newbie question regarding VSCode: versioninfo() tells me I am currently using 1.6.0. But I have 1.6.1 installed, so I’d like to use that instead. Here’s the output from versioninfo:

I tried to change this according to the instructions given here: I went into my Julia extension settings and changed the executable path to

I also went into my settings.json file and set my Julia executable path as the same thing (but with double backslashes, as the documentation says to, since I’m using Windows):

I then restarted VSCode, but it still says I’m using 1.6.0.

Also, I’m not sure if this is relevant, but I noticed that when I go to the executable file in Julia-1.6.1 folder and hover my mouse over the icon, it says “File version: 1.6.0.1”:

This seemed strange to me…However, I am using 1.6.1 when I’m working in Jupyter Notebook, and the Jupyter shortcut I created points to this same file…

So I’m pretty confused as to why I can’t get 1.6.1 in VSCode…Any ideas or suggestions for what I should try?

(I’m using v1.59.0 of VSCode, by the way.)

For me it works with the only configuration in Julia extension settings.
There is nothing in settings.json in my setting.
I have the same odd version for the Julia 1.6.1 binary, so this can be ignored, probably just a typo somewhere in the build process.

I don’t have any Julia entry in the environment PATH variable, so this may be the cause for your experience. Check if there is something in PATH : echo %PATH% I don’t know but perhaps it takes precedence over the other settings.

Another source could be: perhaps you have installed Julia 1.6.0 from the Windows store? In this case Julia is started from C:\Users\YOUR_NAME_HERE\AppData\Local\Microsoft\WindowsApps which is in the path by default, again this may take precedence.

1 Like

Thanks for your reply. Here’s what it shows when I tried echo %PATH% in the command prompt (I underlined all the paths containing Julia):

(Not sure why the paths for 1.6.0 and 1.6.1 are listed twice–I did try downloading 1.6.1 a second time to fix the problem, so maybe that’s why 1.6.1 appears twice…)

And I didn’t download Julia from the Windows store, I just went to Download Julia.

I figured it out! Here’s out I solved it (I’m using Windows 10, by the way):

  1. I went to Control Panel → View advanced system settings → Environment variables

  2. In the new window that popped up, I went to User variables, selected the one named Path and then clicked Edit.

  3. In the new window that appears, I located the path variable of my 1.6.0 installation, selected it, and then clicked Delete.

  4. I clicked OK, and then selected the environment variable named Path from the System variables, found the path for 1.6.0, and deleted that one as well.

  5. I restarted VSCode, started julia, and confirmed that 1.6.1 is now running!

10 Likes

One thing I should add, though I’m not sure if it matters:
Before deleting the 1.6.0 path variable, I went into the Julia extension settings and selected “Reset setting”, which made the box for the executable path blank. After deleting the 1.6.0 path variable, I checked the extension settings and the path variable there is still blank. And in the JSON file, the path got deleted as well: It now reads "julia.environmentPath": "". So apparently, VSCode was able to find my 1.6.1 installation automatically, without me having to explicitly specify it. I assume this is because of my Windows environment variable for the 1.6.1 path.

Very good description of the Windows way to edit the PATH variable. I will bookmark it, to refer to it for others in future.

Your issue here is the reason why I avoid completely having Julia in the PATH. During installation of the Julia it asks to put the current Julia into the PATH, there I recommend to unmark the option, so that it doesn’t happen. The main reason for me to prefer it his way is because I have typically many versions of Julia installed and than the PATH is just too cumbersome.

Than I have to configure the applications, VSCode and Windows Terminal, to find the different Julia versions I have. That’s much easier and I can’t forget, which version is found in which way.

1 Like

What I do is create a junction link called “Julia” to the installed Julia-x.x.x version, for example:

>mklink /J C:\Users\Michael\AppData\Local\Programs\Julia C:\Users\Michael\AppData\Local\Programs\Julia-1.6.0

Then I put the Julia link in the PATH environment variable, and otherwise use the Julia link for anyplace I need to specify a Julia path.

When I upgrade Julia versions, I only need to delete the link and create a new one that points to the new version.

3 Likes

Hi @Michael_Barmann,

On a Windows 10 machine, we do not need to delete anything in the system’s “Advanced settings” to change the Julia version in VSCode. We can do it if we want, but it is not either necessary or user-friendly. Moreover, it looks terrifying for newbies, and we may want to use some previous versions of Julia. Deleting them from the Path is not the best option.

The easiest way to do it is: (1) Open the Julia extension for VSCode, (2) Click on “Manage” (the small weel in the first image below), (3) Open “Extension settings” (first image below), (4) Go down until one finds “Julia: Executable Path” (see second image below), (5) Choose the Julia version you want VSCode to work with (e.g., from Julia-1.6.3 to Julia-1.6.4, just replace the number 3 by a 4), (5) Restart VSCode.

Then type shift+ctrl+P; to start REPL choose Julia: Start REPL; then type in REPL versioninfo(), and one will see the Julia version we are working within VSCode.

aab

aaa

6 Likes

On Windows 10, it can get even more “handsfree” than editing the Julia Executable Path in the VS Code extension settings. One can just leave that field blank, and use the juliaup version control tool that comes with the Julia installer in Microsoft Store. Once installed from there, VS Code will just find that executable as juliaup does the PATH management for you. One great advantage is that when updating (shell> juliaup update whenever a new release is available that you want to install), and restarting VS Code, it will also automatically find that new version, without you having to think about changing that path in the extension settings. Moreover, juliaup lets you install multiple versions (such as older ones, or beta releases) next to each other in parallel channels. By just switching the juliaup default channel, you can also easily change the version used in VS Code.

Check out David Anthoff’s presentations on JuliaCon 2021:

3 Likes

@Klaas_Pauly, that is the easiest option. However, I am not sure it is the best option currently available.

There is a significant lag between the release of new Julia versions and the ones available in the Microsoft Store. I taught a course and tried to use it this way, and it was quite messy (with eighty students, it proved to be much easier to follow the good old way). The currently available version of Julia in Microsoft Store was released … on 5/23/2021.

That is strange… Maybe @davidanthoff can comment on availability. I do agree that it’s necessary to keep the latest version of the juliaup tool itself installed to enjoy the full benefits, and unfortunately that doesn’t always happen automatically (or as fast as you would want): sometimes you have to go into the Microsoft store and manually click update there, even when you just installed it freshly. But I just updated my juliaup today in the Microsoft store to v1.4.1 so it is certainly available. After that, it immediately indicated that the Julia 1.7 release was available for juliaup update.

There are many Microsoft Stores in the world, and they are managed in different ways. In the Portuguese one, here

one will find

I think there are times when we are offered the possibility to choose to go to the US MS Store or keep on with the Portuguese one. Sometimes, not. Don’t know why.

Are you actually looking at juliaup and not some Julia version there?

FWIW I think the delay between the official release announcement and the new version becoming available on juliaup was on the order of minutes, maybe a couple hours at most.

1 Like

To my knowledge there is nothing else out there in the Microsoft Store than the juliaup tool, and it is actually just called Julia, so I don’t think you can miss it. Regarding that indicated launch date (Data de lançamento), that to me seems just the original launch date. I didn’t actually know about the multitude of Microsoft Stores, but when I look in mine (based in Belgium), I also see that same launch date, and I agree that these listed metadata are confusing (the current version and release date would be more helpful, but I’m not sure this is something David Anthoff can force from his side). Nevertheless, it just gives me juliaup 1.4.1 when I click that Install or Update button. Can you try installing it, if necessary also update immediately after, and then in the shell type juliaup help just to verify which juliaup version you have then? Alternatively, can you try downloading from store.microsoft.com/en-us to circumvent any “local” version of the Microsoft store, if any? (it also indicates that same launch date there, but I assume this would be the most centrally managed Microsoft Store and you will get the latest version there).

I am confused, now. I tried juliaup in the Microsoft Store and get the message:

“Sorry, no results found for: juliaup”

The old-fashioned approach is terribly simple and works very well. I just tried to help because a student of mine came across this issue and sent me an email asking if all those steps were vital. That’s why I replied to this initial issue. It was leading to confusion rather than elucidating.

No, that is actually what I meant when I said “it is called Julia”, you just need to search for Julia. You definitely had the correct item when you showed the screenshot. But apart from installing Julia, it also installs the juliaup version control, and you will notice that it actually installs Julia to a different folder than when you install from the official binary (C:\Users\~user\.julia\juliaup). Sorry if I added to the confusion :slight_smile: But I just pointed this out as I had an opposite experience from yours: I found that it greatly simplified getting colleagues and students set up with a working and up-to-date Julia and VS Code installation, and ensuring working with the same versions (though I don’t teach large classes, just thesis students).

Sorry for being imprecise. There was some confusion but not created by you. The initial post raised the confusion, coming to a detailed description about the need to delete entries in the systems’ PATH to change the Julia version within VSCode.

1 Like

Yeah, so I think this was already clarified, but just to summarize: there is one listing called Julia in the Windows Store. If you install that, everything should be automatically kept up-to-date, with at most sometimes a prompt showing up saying “Hey, run X to update to the latest available version”.

Thanks! Yeah, I updated to 1.8 via juliaup but VS code wasn’t picking it up. Deleting the path in the Julia extension did it. And I think from here on it will all be synced.