Reading Packages

Last updated: January 12, 2023

Standard library

A set of packages are installed when you install Julia. They are stored in the standard library or stdlib (in Linux, they are in /usr/share/julia/stdlib/vx.x , where vx.x is the installed Julia version).

Here is the list:

Base64
CRC32c
Dates
DelimitedFiles
Distributed
FileWatching
Future
InteractiveUtils
Libdl
LibGit2
LinearAlgebra
Logging
Markdown
Mmap
Pkg
Printf
Profile
Random
REPL
Serialization
SHA
SharedArrays
Sockets
SparseArrays
Statistics
SuiteSparse
Test
Unicode
UUIDs

They are not automatically loaded at the start of a session, so before you can use them, you need to load them as you would do for external packages.

External packages

To add functionality to Julia, you can install external packages from an ever-growing collection developed by the Julia community.

How to find external packages

All registered packages are on GitHub and can easily be searched in JuliaHub or Julia Observer.

GitHub allows to easily get an idea about the popularity of a package (number of stars) and whether it is under current development (age of latest commit).

These packages get installed in your personal library (in linux, it is in ~/.julia ).

How to manage external packages

In package mode (accessed in the Julia REPL by pressing ] ), you can manage your personal library easily with the following commands:

pkg> add <package>        # install <package>
pkg> rm <package>         # uninstall <package>
pkg> status <package>     # status of <package>
pkg> update <package>     # update <package>

pkg> status               # status of all installed packages
pkg> update               # update all packages

Notes:

  • Replace <package> by the name of the package (e.g. Plots)
  • You can use up instead of update and st instead of status
  • To install, uninstall, or update several packages at once, list them with a space:
pkg> add <package1> <package2> <package3>

An alternative to this convenience mode is to load the package manager (part of stdlib), called Pkg and use it as you would any other package:

using Pkg

Pkg.add("<package>")        # install <package>
Pkg.rm("<package>")         # uninstall <package>
Pkg.status("<package>")     # status of <package>
Pkg.update("<package>")     # update <package>

Pkg.update()                # status of all installed packages
Pkg.status()                # update all packages

Notes:

  • The short forms up and st do not work in this context
  • To install, uninstall, or update several packages at once, you need to create an array:
Pkg.add(["<package1>", "<package2>", "<package3>"])

Loading packages

You can load a package with using <package> (e.g. using Plots).

Comments & questions