Finding and Installing Packages

How to add a package, keep a project reproducible, and find the one you need

The list of packages worth having is on one page: Recommended Packages. This page is about the mechanics around it.

Installing

using Pkg
Pkg.add("CairoMakie")          # or, in the REPL: ] add CairoMakie
Pkg.status()                   # what this environment holds
Pkg.update()                   # update everything in it
Pkg.rm("CairoMakie")

Press ] in the REPL for package mode, and backspace to leave it.

One environment per project

An environment is a Project.toml and a Manifest.toml in a folder. The first records what you asked for, the second records the exact versions that were resolved. Activate one before you add anything:

] activate .        # in your project folder
] add Mera CairoMakie
] instantiate       # on another machine: install exactly what the Manifest names

Without this, packages land in your default environment, where one project's version bound can hold another project back. Keep both files next to the analysis script and in version control. Reproducibility covers what else a result needs to be repeatable.

Finding a package

Check the repository before you depend on a package: when it was last touched, whether it has tests running, and whether the documentation matches the current version.

Calling other languages

  • Python: using PythonCall; np = pyimport("numpy")
  • R: using RCall; R"summary($x)"
  • C and Fortran: ccall, which is part of Julia

Where to next