Julia Setup and Package Management
TL;DR
- Install Git
- Install VS Code
- Install Julia following the juliaup instructions
- Windows:
winget install julia -s msstorein a terminal - Linux/Mac:
curl -fsSL https://install.julialang.org | shin a terminal
- Windows:
- Install the VS Code Julia extension
Some Common Julia Installation Errors on MacOS
To open a terminal on MacOS
- Press
Cmd + Spaceto open Spotlight, then typeTerminal - Or with VS Code
<Cmd-Shift-P>thenView: Toggle Terminal
- Press
If you get permissions problems try
sudo curl -fsSL https://install.julialang.org | shIf it still shows errors, then see here and do some combo of
sudo chown $(id -u):$(id -g) ~/.bashrc sudo chown $(id -u):$(id -g) ~/.zshrc sudo chown $(id -u):$(id -g) ~/.bash_profile- Then retry
sudo curl -fsSL https://install.julialang.org | sh
- Then retry
Package Environment
Julia Environment Basics
- Project files keep track of dependencies and make things reproducible
- Similar to Python’s virtual environments but easier to use
- VS Code and Jupyter will automatically activate a
Project.toml- In REPL or Jupyter enter
]for managing packages - Can manually activate with
] activateor] activate path/to/project - On commandline, can use
julia --project
- In REPL or Jupyter enter
- With activated project, use
] instantiateto install all the packages - For this course: no package management required after instantiation
Reproducibility
- ALWAYS use a
Project.tomlfile- Keep your global environment as clean
- Associated with
Project.tomlis aManifest.tomlfile which establishes the exact versions for reproducibility] instantiatewill install the exact versions- Less important for us, but very useful for reproducibility in research to distribute with project