Published on

Updating Your Julia Installation (Mar 2022)

Authors

Had the hassle of trying to update Julia this weekend and I gotta say, every time there's always something I forget, so here's my best tips on what it takes to update your installation of Julia in Mac/Linux:

Step 1: Use jill/pyjill to Download & Install Julia

I used to mess with downloading the binaries and install files directly from the julialang site and also tried homebrew, but both of these options were really clunky when it came to updating your existing installation. Instead, I just use pyjill (Github), which works perfectly on both OSX, Windows, and Linux (note: requires python >=3.6).

# Install or update the latest version of jill (requires python>=3.6)
pip install jill --user -U
# export the jill PATH somewhere, if this is your first time installing jill
echo 'export PATH=$PATH:/home/$USERNAME/.local/bin' >> ~/.personal_macros
source ~/.zshrc
# Install the latest stable release
jill install

Then the next time you need to update Julia, you only need to do jill install to get the latest.

Step 2: Remove the Old .julia Folder (optional, linux/OSX instructions)

Another time sink I had was realizing that with a fresh update, I couldn't add packages anymore to julia because I didn't have root access to a folder hidden deep within the .julia folder in my user directory. I had to delete it and then julia worked fine after that after rebuilding the registry. This might not be as much of an issue after Julia 1.7, where they changed the manifest and how the package registry handles different Julia versions.

# Go to your home directory
cd
# Delete that sucker with prejudice
sudo rm -rf .julia

Step 3: Update Jupyter Kernels

Next we'll need to remove the old julia kernel from Jupyter with jupyter kernelspec remove {{ kernel name }}:

# See the list of existing jupyter kernels and find your old install
jupyter kernelspec list
# My previous one was called julia-1.6, let's remove it
jupyter kernelspec remove julia-1.6

Then use IJulia to add a new one. Whenever you change the Julia binary you need to have IJulia rebuild in order to register the new kernel to jupyter, so go back to Julia and go to the Pkg prompt:

# In the Julia REPL, press the ] key to bring up the Pkg prompt
(@v1.6) pkg> add IJulia
(@v1.6) pkg> build IJulia

At this point, if you're upgrading from Julia 1.7+ and it's a minor update (i.e. 1.7.2 to 1.7.3), your base package manifest should still be there and Julia will precompile and build those other packages so they'll be ready to go - no need to re-add them.

Step 4. Update Your Libraries (if upgrading from Julia < 1.7)

From here on out you'll need to probably build and update your other libraries too, and if you use stuff like PyCall(link) where it downloads a distribution of python and hides it in your julia folder, have fun managing all of that! I'll do a writeup later when I figure this out a little more.

# A few common libraries that I install for data exploration and analysis
(@v1.6) pkg> add Plots Gadfly DataFrames DataFramesMeta XLSX CSV RDatasets Parquet Pluto Query