Using Julia on computing clusters
I wanted to use Julia on computing clusters with Jupyterhub at LMU. So I first checked if Julia is installed using:
pip show juliawhich gave me the info about the installed Julia. But when I run:
juliaThis returned:
-bash: julia: command not foundand didn’t activate Julia. So I searched for this issue and got what I want from the website here.1
One should use the commands below:
module avail juliawhich will show available Julia versions with their path. Then run:
module load julia/1.x.x # version you want
julia # type juliawill start the Julia interactive session.
Install Julia kernel for JupyterNotebook
julia> # start package manager by pressing ] key
(@v1.10) pkg> add IJulia
(@v1.10) pkg> # leave package manager by pressing backspace/delete
julia> using IJulia
julia> installkernel("Julia")Work with Environment2
This is similar to creating python virtualenv which is necessary for working with your own projects and environments on clusters.
When you first creat a project/env:
(@v1.10) pkg> activate <YourProject>
(YourProject) pkg> st
Status `~/YourProject/Project.toml` (empty project)
(YourProject) pkg> add Plots # add pkgs you want
(YourProject) pkg> activate # leave the environment, then you go back to the default environment
(@v1.10) pkg>When you already have the project/env3:
cd <YourPathToYourProject>/<YourProject>
julia --project=.
julia> # press ]
(YourProject) pkg>or:
julia
julia> # press ;
shell> cd <YourPathToYourProject>/<YourProject>
shell> # press backspace and then press ]
(@v1.10) pkg> activate .
(YourProject) pkg>Add an additional Julia kernel4
(YourProject) pkg>
julia> IJulia.installkernel("Julia YourProjectEnv", "--project=$(Base.active_project())")The Launcher now has a new icon for starting a new jupyter notebook with “Julia YourProjectEnv”.