Juliaup really is magic

I used to install Julia manually using DMG file on my M2 Mac and I used rosetta2 to emulate X86 on my macbook.

Lately I switch to

  1. Apple Silicon Code
  2. Juliaup

I did it by removing all traces of ~/.julia and the old x86 julia applications and all my symbolic links to my julia applications

and install juliaup according to the instructions on juliaup webpage.

Now I can really appreciate the juliaup MAGIC.

$ pwd
/Users/ssiew/juliascript/PlotExamples
$ juliaup add 1.11
Installing Julia 1.11.0+0.aarch64.apple.darwin14
Checking standard library notarization............................................................done.
$ juliaup default 1.11
Configured the default Julia version to be '1.11'.

So easy!

6 Likes

Apparently I donā€™t even need ā€œjuliaup add 1.11ā€

I could have just done ā€œjuliaup updateā€ as I discovered below

$ juliaup status
 Default  Channel  Version                          Update                                              
--------------------------------------------------------------------------------------------------------
       *  1.11     1.11.0+0.aarch64.apple.darwin14                                                      
          release  1.10.5+0.aarch64.apple.darwin14  Update to 1.11.0+0.aarch64.apple.darwin14 available 
$ juliaup update
$ juliaup status
 Default  Channel  Version                          Update 
-----------------------------------------------------------
       *  1.11     1.11.0+0.aarch64.apple.darwin14         
          release  1.11.0+0.aarch64.apple.darwin14         
$ juliaup default release
Configured the default Julia version to be 'release'.
$ juliaup status
 Default  Channel  Version                          Update 
-----------------------------------------------------------
          1.11     1.11.0+0.aarch64.apple.darwin14         
       *  release  1.11.0+0.aarch64.apple.darwin14         
$ juliaup remove 1.11
Deleting symlink julia-1.11.
Julia '1.11' successfully removed.
$ juliaup status
 Default  Channel  Version                          Update 
-----------------------------------------------------------
       *  release  1.11.0+0.aarch64.apple.darwin14     
2 Likes

If you donā€™t need to use 1.10 for some projects, then you can just use release which happens to be 1.11 at the moment.
On the other hand, if you use lts, you will find it pointing to 1.10

1 Like

Personally I still canā€™t find the utility of juliaup on Linux/Macā€¦ using symlinks it works perfectly, it is super easy and you know what you are doingā€¦ I have ~/bin/julia symlinked to ~/bin/julia1.11 in turn symlinked to ~/lib/julia-1..... and so for julia1.10, 1.9, etcā€¦

2 Likes

But with juliaup it is easier to have different versions of Julia per project.

I used to have a similar setup before starting to use juliaup and it worked fine. What made the difference for me was that the trivial steps of downloading a release, unpacking it, and symlinking it was enough friction that I tended to skip patch releases and delay minor releases for weeks to months. I have found juliaup update or juliaup add to be so much more ergonomic.

10 Likes

What do you mean per project ?

For me, a project is a folder that contains a Project.toml file. To run julia in a project you launch it with julia --project.

And with juliaup you can use a command like:

juliaup override set lts 

to set a directory override for the current working directory to lts, or to any other version.

9 Likes

Do you have to do it only once? So this is saved somewhere and the next time you use julia in that specific project directory (or using VSCode ) it defaults to that specific version ?

Also just doing juliaup update nightly is sooo convenient to live on the edge :wink:

6 Likes

Yes. And you can use specifiers like lts or release or 1.10 or 1.10.2, many options. I did not try it with the VSCode Julia console yet, because even in VSCode I just use the normal bash terminal.

5 Likes

To be more specific:

~/advent_of_code$ juliaup override status
 Path  Channel 
---------------
~/advent_of_code$ juliaup override set 1.10

~/advent_of_code$ juliaup override status
 Path                         Channel 
--------------------------------------
 /home/gunnar/advent_of_code  1.10  

~/advent_of_code$ tail -n 10 ~/.julia/juliaup/juliaup.json 
  },
  "Settings": {},
  "Overrides": [
    {
      "Path": "/home/gunnar/advent_of_code",
      "Channel": "1.10"
    }
  ],
  "LastVersionDbUpdate": "2024-10-08T13:19:28.906736955Z"
6 Likes

ā€¦ and this also seems to affect the subdirectories.

If I can have my way, there will be more magic to come :wink: :magic_wand:

3 Likes

I want more MAGIC!

And a tutorial in juliaup.jl webpage on how to use ā€œjulia overrideā€

currently it says

QUOTE

  • juliaup override set lts sets a directory override for the current working directory to the lts channel.

UNQUOTE

it should say
cd /home/johnsmith/juliadir/myprojectA
juliaup override set 1.10

This would mean that juliaup uses julia version 1.10 for lines like
ā€˜julia --project=/home/johnsmith/juliadir/myprojectA juliaprogramA.jlā€™
will use julia version 1.10 to run juliaprogramA.jl

1 Like

Something magic that would be nice: automatically ensure that a defined set of packages (Revise, Infiltrator, BenchmarkTools, IJulia, etc) is available in every base environment, and that

IJulia.installkernel("Julia", "--project=@.")

is called if the kernel doesnā€™t already exist.

Is there a trick to ensure that kind of initialization for every new minor version, right now?

2 Likes

The magic Iā€™m working on is more around ā€œjust gettingā€ the right per-project Julia version without having to mess with per-directory overrides etc.

1 Like

Note that while these packages are very useful for a particular purpose, not all of them are universally used (eg those who donā€™t use notebooks donā€™t use IJulia).

I would stop using juliaup if it started adding packages I do not need.

1 Like

Oh, I donā€™t want it to do this out if the box. This should definitely be customizable. Iā€™d probably just want to be able to have a file juliaup_init.jl or something that juliaup executes whenever it installs a new minor version. Kinda like startup,jl

2 Likes

You can just modify your startup to make them be installed in the global environment

1 Like