Julia programming


2022-04-04

Julia

For the last year I've grown quite interested in the julia language as a tool to potentially replace python in my daily workflow. As I've started developing some tools on it, I've also started working with students using this language. So I thought it would be a good idea to copy in here the quick instructions I've given them on how to get started with this language.

You can download the latest version in here. Just untar it to your home directory, the executable is in the bin folder. For practice you can add that to your PATH variable so your shell knows where to find it. In a shell you can do:

export PATH="$PATH:/home/pablo/julia-1.6.5/bin"

Just replace with your own home directory and the actual version of julia you downloaded. That will allow you to simply run "julia" in the shell and open the REPL (read-execute-print-loop), which is just a simple interface to do simple tests (similar to ipython). Rather than doing the export command all the time, you can add it to the ".bashrc" file in your home folder, which will make it work in all new shell sessions.

One nice thing about julia is that it makes it easy to work with different environments, this allows you to have a bit of a clean slate when working in different projects and it can help when you have projects with different installed third party packages. So its useful when you start working on something to create an individual folder, and in that folder start julia with:

$ julia --project=.

As you add packages into a project this creates two files in the folder that end in "toml", and just keeps track of all packages you've add. After that if you want to use a jupyter notebook with julia, just press "]" in the julia REPL. this opens up the package manager which makes it easy to install various packages.

julia> ]
pkg> add IJulia

press backspace to go out of the package manager, then load IJulia and run the notebook

julia> using IJulia
julia> notebook()

Regarding tutorials, the official documentation is really nice. Youtube is also an excellent source for tutorials:

CC BY-SA 4.0 Pablo Marchant. Last modified: July 23, 2023. Website built with Franklin.jl and the Julia programming language.