Disclaimer: The following instructions contain personal recommendations by the author and are neither "official" nor the only way of installing and setting up Julia. The instructions and included software/scripts are licensed under the MIT license, without warranty, use at your own risk.
This is a short tutorial on how to install the Julia programming language and set things up so you can use Julia Jupyter notebooks (via the IJulia Jupyter kernel) and automatic code reloading (via Revise).
The easiest way to install Julia is using the Juliaup installation manager, just follow the official Julia installation instructions.
(In addition to Juliaup, you can also manually download and unpack/install a binary tarball for Linux, a binary tarball or a disk image for OS-X, and either a standalone installer or a portable ZIP archive for Windows.)
On Windows (only!), you may also need to install the Visual C++ redistributable, e.g. if you want to use CUDA from Julia.
Visual Studio Code provides a great environment to work with Julia.
Install the
VS-Code Julia extension,
in most cases it should locate your Julia installation automatically. If
not, configure the VS-Code setting "julia.executablePath"
manually.
Also try setting "julia.execution.codeInREPL": true
in your VS-code setting,
it makes code section you evaluate in scripts via Ctrl-enter available in the
Julia REPL history afterwards.
You should be able to run Julia Jupyter notebooks directly within Visual Studio Code without any additional configuration. By default, VS-Code Julia notebooks use the same Julia version/installation that is used by the VS-Code Julia extension, so no Jupyter kernel configuration is required.
If you want to run Julia Jupyter notebooks outside of Visual Studio Code, you will also need a working Jupyter installation. JupyterLab Desktop is easy to install, but an Anaconda or system/custom Python installation that includes Jupyter will work too, of course.
For non-VS-Code Jupyter notebooks you also also need to install the IJulia Jupyter Julia kernel (see next section).
Now open a Julia REPL. To open a REPL, you can
-
use Ctrl+Shift+P (Shift+Command+P on OS-X) and select "Julia: Start REPL" in Visual Studio Code, or
-
start the Julia application on OS-X or Windows, or
-
run
julia
in a shell/terminal if the Julia executable is on your$PATH
.
Then run
julia> include(download("https://raw.githubusercontent.com/oschulz/julia-setup/main/julia_setup_ijulia_revise.jl"))
to install and configure IJulia and Revise. Note that IJulia and Revise should always be installed in your default Julia environment (not in individual project environments) to avoid version conflicts: the Jupyter kernel configuration is tied to a specific IJulia install path. "julia_setup_ijulia_revise.jl" takes care of this automatically.
To manually install IJulia instead, run
julia> import Pkg; Pkg.activate(); Pkg.add("IJulia"); Pkg.build("IJulia")
(IJulia is not required to run Julia Jupyter notebooks in Visual Studio Code, but installing it anyway doesn't hurt.)
Now press "]" to enter the Julia package management console and add some Julia packages you need, like
(@v1.10) pkg> add Plots
Note: Later on, you will probably want to use separate Julia project environments for different use cases, instead of adding all packages you may possibly need to your default environment. Julia project environments are lightweight (different from Python virtual environments) and easy to manage.
Press backspace or Ctrl+C to get back to the main Julia REPL. Test if you can make a plot:
using Plots
plot(rand(100))
You should be all set now, have fun with Julia!