Running several versions of Julia

Hi,

tl;dr What’s the best way to easily switch back and forth between multiple Julia versions?

System Config

First, my setup… I have a Linux machine with a julia directory containing

chad@boondoggle:~/julia
➤ tree -L 2
.
├── julia-1.4.2
│   ├── bin
│   ├── etc
│   ├── include
│   ├── lib
│   ├── libexec
│   ├── LICENSE.md
│   └── share
└── julia-1.5.0
    ├── bin
    ├── etc
    ├── include
    ├── lib
    ├── libexec
    ├── LICENSE.md
    └── share

Then, my ~/.local/bin (which is in my $PATH) has symbolic links

julia14 -> julia-1.4.2/bin/julia
julia15 -> julia-1.5.0/bin/julia
julia   -> julia15

The idea here is that it’s really easy to call either at the command line, or to change ~/.local/bin/julia point to whichever I want to consider the default.

The Problem

I’d like to be able to do this without clobbering my .julia directory each time I switch. Is there anything special I need to do? Environment variables, etc?

More generally, is this a reasonable way to set things up for switching back and forth? Any other recommendations to make this easier?

1 Like

This should be totally fine. Each minor version of Julia has its own global package environment, so installing something in Julia 1.4 won’t affect what you have in Julia 1.5. All of your Julia versions will share the same cache of (immutable) package downloads, but they can use different packages and different versions without you doing anything special.

This is almost exactly what I do, and it has worked well for me for a long time.

4 Likes

+1, works well for me as well.

2 Likes

Great, thank you both. I’m hitting some errors, but I think it must be a bug in the application. Very helpful to be able to rule out system setup as the culprit. :slightly_smiling_face: