How do I add [1.5.3] to VS code in Ubuntu?

I am not sure what your status is now. Do you still require help? If you’ve exported your path properly (and the executable path is left blank), the language server extension should also launch 1.5.3. I’d also advise to make sure everything (i.e. vscode and extension) are updated.

I can’t find the latest version of the Julia extension in the VS marketplace, and the version is old, but you can see, that I have 1.5.3 in my Linux terminal, so I can run
Pluto, and should be able to run Jupyter. I guess I’d like to get it working in VS Code, but it’s not necessary.

Julia and Julia Extension for vscode are two very separate things with different version numbers. Julia is the programming language and can be used with any editor of your choice (or even directly from the terminal). Your Julia version is 1.5.3, but you may have other versions installed as well.

The Julia Extension for vscode is an extension primarily built with typescript (I think) and interfaces with the features provided in vscode. It’s got functionality for launching code, showing inline results, showing plots, providing a debugging toolchain, linting, and overall interacting with the julia REPL. The current version of this extension is 1.0.12 (you have 1.0.10 which is fairly new as well but you can update if you want). So everything seems fine to me.

I don’t understand though why your Julia REPL in vscode defaults to some 1.0 version. This is likely because you’ve told the extension to look for Julia in a particular location and thus overwriting the mechanism that uses the $PATH variable. Can you show your JSON settings file? And make sure your executable path is left blank?

1 Like

I think 1.0.4 is the snaps version, I downloaded 1.5.3 and 1.6 later. That’s why I thought I had to put a new location. So, it would use the later version instead of the one I downloaded first.

I tried to change from 1.5.3 to 1.6, and it loaded 1.0.4 .

Unless of course 1.6 Linux has the 1.0.4 load screen. Plots loaded faster to Pluto than 1.5.3, I might try something like ModelingToolkit.jl, that doesn’t work right in older versions.

No, it’s not likely that the 1.6 version has “1.0.4” on the launch screen. That would’ve been caught already in testing.

Recall I said that when you type in julia it traverses the folders stored in $PATH. And it does so sequentially and as soon as it finds the first folder where julia resides, thats the one it launches.

Notice how you modify your $PATH:

export PATH = "$PATH:$HOME/Julia...." 

which basically adds your 1.6 folder at the very end.

What this means is that you likely have another julia binary (the 1.0.4 version) in one of the folders stored in $PATH. If you run

affan@XPS13:~$ which julia
/usr/bin/julia

it will tell you where the actual binary is located. You should likely delete that binary as its the old version. I have a feeling that if you installed 1.0.4, the binary likely exists in /usr/bin/julia or /usr/local/bin/julia

Can you tell me what the output it for which julia?

It’s better to leave that field blank and just modify your PATH so that the correct julia version launches. Well maybe not better, but that’s how I would do it.

Where do I modify my path? is that the JSON in VS?

No, your system path: PATH (variable) - Wikipedia

No. Has nothing to do with vscode or JSON. See my reply here: How do I add [1.5.3] to VS code in Ubuntu? - #13 by affans

PATH is a Linux environment variable. It is a list of directories that Linux uses to search for particular binaries. It is how when you type in a binary say julia or echo, it knows where the binary is. So if you want to know which particular julia binary when you type in julia, you can see that by running whereis julia. The point is that you should include your julia directory in the path variable (if its not already there) so that simply typing in julia will launch the correct version, and that goes for vscode also. You can modify PATH by using the export function.

Ok, thanks, sorry I didn’t get back sooner. The export works, but I have to reset it each time I start a new session. Why is this and how do I get it to stay?

There is a file in your home directory called .bashrc (notice the dot). Modify this file and add the export statement in there as a new line.

No, I don’t see any file like that, might it be hidden?

Yes, files that begin with . are hidden. Use ls -a to show all files. If you don’t have it, you can just create it yourself. Call it .bashrc

Ok, that found it. Now how do I open it?

It’s just a text file so you can edit it anyway you want. You can open it in vscode (since I know you have that installed), or you could use gedit or vi (which are terminal based editors) or any other editor that comes with Linux. It’s a simple text file.

I meant what terminal command do I use to open the file, (text editor would be fine, but changing default to VS code wouldn’t hurt).

To open the file using vscode (assuming the binary is also in your $PATH) you can type in

code .bashrc  # open using vscode 
gedit .bashrc # using gedit (probably the easiest) 
vi .bashrc # would not recommend if you don't know what vi is. 

or commands for any other text editors you have installed. Are you working on headless Ubuntu? Do you not have a GUI? It might just be easier to up the GUI file explorer and double click the file like in windows.

1 Like

Thanks, got it set up.