A proper introduction on how to update julia somewhere accessible?

So I recently had to update Julia. After some hand-holding from a colleague it worked out. I’ve had to do this two times before, the first time it worked out fine after someone at JuliaCon did it for me. The second time was a big headache. I think a problem is that there are no proper guide on how to do online, and what exists typically assumes that the reader understands computer systems quite well (and these users are usually the ones least requiring the help).

So after I got everything to work I wrote down a short guide, “A guide that would have helped me to update Julia”. Basically, I wrote down the instructions that would have enabled me to update my julia version, without requiring help from someone else. I think that Julia as a language would benefit a lot of a similar guide would be available for all operating systems. Especially for us less “tech-savvy” (i.e. who might be very good at putting algorithms together, and make things happen in a computer program, but who have dubious knowledge about everything around it) for which certain aspects of Julia can be a bit daunting.

Ideally I think there should be an instruction page on the Julia website, linked from the julia download page (https://julialang.org/downloads/). There is already some in https://julialang.org/downloads/platform.html, however, I think these could use some extending (at least the Linux one, I have not tried the Windows and Mac, and considering these operating systems their guides might be enough). I can see if some think including instructions for Juno and/or IJulia is not appropriate on this page, but at least having a link to such popular platforms, and their update instructions would be greatly helpful.

Finally my “guide”. It is not actually meant to be published as such, however, it is meant to illustrate to those more experienced users (for this is a “trivial” matter), what level of instructions would be helpful for us less knowledgeable.

A guide which would have helped me to update Julia

This is a guide that would have enabled me to update Julia from 1.1 to 1.2 on my Ubuntu 18 machine. It probably should not be used for publication online. However, it might help more experienced user (for which this is “trivial”) to understand what level of detailed might be required to comfortably help a less experienced user with the process.

Downloading Julia

  • This must be done before you can update Julia for the terminal, Juno, or Jupyter.
  • Go to the Julia download page, https://julialang.org/downloads/
  • For the desired version (in this case v1.2.0), click on the 64-bit Generic Linux Binaries for x86 (ignore the GPG thing).
  • Download the archive and open it. Put the “julia-1.2.0” folder somewhere on your computer. Anywhere works, but the home directory is suggested.

Updating Julia for the terminal.

  • To ensure that it is the new version of julia that is being run when you write julia in the terminal you have to update your PATH.
  • In the julia folder (“julia-1.2.0”) that you put somewhere, there is a “bin” folder. The location of this must be added to your PATH.
  • You can do this by finding your “.bashrc” file (It is a hidden file, located in your home folder). Open this as a normal text file.
  • Add this at the very end
# <<< Add Julia 1.2 to Path >>>
PATH="/home/torkelloman/julia-1.2.0/bin:$PATH"

Updating Julia for Juno

  • Start Juno.
  • Open the Julia drop down menu (among the option on the upper left). At the very bottom, open the Settings menu.
  • Go to “Julia Path”. Here is the path to your current julia version. Change that to the corresponding path for the location of the new julia file. E.g. I had to change from /home/myname/julia-1.1.1/bin/julia to /home/myname/julia-1.2.0/bin/julia
  • Restart Juno to be sure that everything works.

Updating Julia for Jupyter

  • In either the Julia console, or in Juno, write this:
using Pkg
Pkg.build("IJulia")
  • Now when you start Jupyter, when you create a new notebook, there should be an option for creating a notebook with Julia version 1.2.0

Updating Packages

  • When you start up the new version of Julia, the packages you have might not necessarily have followed. These may be added manually, as when you first installed julia. However, there is an alternative.
  • Open the “.julia” folder (a hidden folder, probably located in your home directory). Within it, open the “environments” folder.
  • Open the folder corresponding to your previous julia version (in my case called “v1.1”). Copy “Manifest.toml” and “Project.toml” files.
  • Go back to the “environments” folder, and open the folder corresponding to the new julia version (in my case “v1.2.”.
  • Paste the “Manifest.toml” and “Project.toml” files into this folder, overwriting the old ones.
  • In a julia session, run
using Pkg
Pkg.update()
22 Likes

Thanks for writing this up! I agree having guides like this is important. Hopefully, at some point there will be more tooling for stuff like this.

A couple of suggestions - I think it’s typically considered better practice to symlink the julia executable in someplace like ~/bin (or ~/.local/bin`). You can do this by doing

$ ln -s "$HOME/julia-1.2.0/bin/julia" "$HOME/bin/"

If it’s not there already, you can add ~/bin to your path in `~/.profile:

if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

This way even Juno finds it, and you can skip the “Updating Julia for Juno” part (just leave the default julia). I should say, I’ve only started doing this recently, I used to litter my PATH with all kinds of stuff in the way you’re describing, but over time it can get really messy.

Another minor suggestion, at the end where you talk about updating packages, you can of course do that, but if you want to reproduce the environment exactly, you can instead do Pkg.instantiate() after you’ve copied over the .toml files into the new environment.

7 Likes

Another tip: if you’re on Linux, you can use Jill which I’ve found to be enormously helpful.

2 Likes

On Windows there are really no instructions needed. On Linux, use Jill like the previous poster suggested.

I’m not sure this is recommended for a novice user though, since running arbitrary code from a link like that is a pretty serious security risk.

1 Like

It’s true. However, it is ultimately the most pleasant install experience I’ve ever had, considering that fact that Julia’s availability on standard PPAs (i.e. no sudo apt install julia) is terrible.

I wonder if it’s worth making a more widely available version of this that falls under the Julialang arm and is more secure.

1 Like

The code is right there at the link. If it wasn’t trustworthy, I wouldn’t use it and certainly would not recommend others to do so.

Right - but you can evaluate the trustworthiness of the code. If the author decides to be malicious, or is compromised, unsophisticated users may not know.

1 Like

A very helpful guide, thank you!
What’s the proper way do you think to remove the old version and its environment?

It depends on how you installed it in the first place. Typically, Julia does not put anything outside of ~/.julia and its primary directory (the place where you cloned it if you built from source, where you unpacked it if you downloaded the tarball, or the application if you’re using the dmg on mac - I don’t know the equivalent for windows). So to completely remove it, you can just remove ~/.julia and wherever your install directory is.

If you’re installing a new version, you can also hang onto ~/.julia and just remove the subdirectory environments/<old_version>. Everything else is pretty consistent, though you may also want to run ] gc periodically to clean up old unused package versions

3 Likes

Just removed my old version according to your suggestions, thank you!

Since Visual Studio Code now probably is more popular than Juno I was going to add isntruction for this one as well (even though it is quite intuitive). However, I couldn’t edit the main post, so just write it here so that it is avaiabel

Updating Julia for Visual Studio Code

  • Start Visual Studio Code
  • On the left, click the extension symbol (or open via Ctrl+Shift+X).
  • On the Julia Extension box, in the bottom right (still on the left part of the interface) there’s a cog symbol, click this toopen a drop down menu.
  • In the drop down menu, click “Extension Settings”.
  • Search for the field “Julia: Executable Path”. Change this to /home/myname/julia-1.2.0/bin/julia

Adding my experience for another perspective. Just completed my second Julia upgrade. First time around I manually deleted my binary installation and downloaded the newer binary. This last time however, I built from source, and I would recommend this for anyone with the disk space. Process was very easy and well documented on the github page. If or when I need to upgrade again I will just fetch, pull, and checkout the desired version.

So to anyone debating building from source I would say go for it!

4 Likes

There is now more tooling!

]add UpdateJulia
using UpdateJulia
update_julia()

I believe this package will handle “Downloading Julia”, “Updating Julia for the terminal”, and " Updating Julia for Juno" (via the method @kevbonham recommended of symlinking in bin).

Should it also support migrating Project.toml and running Pkg.update()?

4 Likes