User Tools

Site Tools

[download only julia statements]
julia> pkgchk.( [  "julia" => v"1.0.3", "DataFrames" => v"0.14.1", "TimeSeries" => v"0.12.0" ] );


Much functionality is implemented in package libraries. For example, there are about five different plotting packages vying for popularity. Some packages may have been abandoned, some may yet be abandoned. It is up to the user to research what packages they want to build or rely on.

To find out which packages still seem active and remain on track, you may want to investigate

Julia Pulse and Julia Packages seem to be currently on hiatus.

This cookbook will also point you to some of the more popular packages that seem to work reasonably well under Julia 1.0.

Base Packages in Julia 1.0

[download only julia statements]
julia> using <TAB>
Base             Distributed       LibGit2           Pkg               SparseArrays
                 Docs              Libc              Printf            StackTraces
Base64           FileWatching      Libdl             Profile           Statistics
Broadcast        Future            LinearAlgebra     REPL              SuiteSparse
CRC32c           GC                Logging           Random            Sys
Core             InteractiveUtils  Markdown          SHA               Test
                                   MathConstants     Serialization     Threads
Dates                              Meta              SharedArrays      UUIDs
DelimitedFiles   Iterators         Mmap              Sockets           Unicode

(This display was obtained by typing julia> using <TAB> on a fresh install.)

The base packages are documented in the main julia documentation.

Updating all Installed Packages

[download only julia statements]
julia> using Pkg			## load the package manager
julia> Pkg.update()			## smart enough to update all installed packages
  • You can also use the ] prompt to get to an interactive Pkg-REPL-mode instead.

Finding Packages by Names

For now, your best bet is to search Julia Observer, Github's Julia Registry, Julia Pulse, and/or Julia Packages.

Package Installation and Removal

[download only julia statements]
julia> using Pkg			## load the package manager
julia> Pkg.add("Distributions")		## install the package (from the stable channel)
julia> Pkg.rm("Distributions")		## remove the package

Listing Currently Installed Packages

To inspect what has already been installed on the local machine,

[download only julia statements]
julia> using Pkg				## load the package manager
julia> Pkg.add("Distributions")			## add the "Distributions" package
julia> Pkg.installed()				## list all installed (well, we have only 1 installed)
Dict{String,Union{Nothing, VersionNumber}} with 1 entry:
  "Distributions" => v"0.16.4"
julia> Pkg.installed()["Distributions"]		## obtain version number
julia> using Distributions			## compile it for the first time; or use Pkg.API.precompile()
[ Info: Precompiling Distributions [31c24e10-a181-5473-b8eb-7969acd0382f]
julia> Base.pathof(Distributions)		## where is it installed?
julia> Pkg.rm("Distributions")			## remove it

Installing and Removing the (Unstable Development) Master Version

[download only julia statements]
julia> using Pkg							## load package manager
julia> Pkg.add( PackageSpec(name="Distributions", rev="master") ) 	## use the "master" (developer), not the released (stable) version
julia> "Distributions" )					## let's go back to the stable version

Using Packages

julia> using Distributions			## use only after Pkg.add("Distributions") !

julia> using Distributions: Normal,Poisson	## import only two symbols from package 'Distributions'

julia> using Distributions, Statistics		## use two packages

Name Conflicts and Qualifying Function Names Based on Package Name

[download only julia statements]
julia> using DataFrames, TimeSeries;
julia> const df= DataFrame( x=[1,2] );
julia> head(df)
WARNING: both DataFrames and TimeSeries export "head"; uses of it in module Main must be qualified
ERROR: UndefVarError: head not defined
julia> DataFrames.head(df,2)			## the fully qualified name form works
2×1 DataFrame
│ Row │ x │
│ 1   │ 1 │
│ 2   │ 2 │

Quasi-Required Packages For This Cookbook

Part 1

The following packages are either essential or used in Part 1 of this cookbook:

  1. Basic Functionality: BenchmarkTools, CategoricalArrays, DataStructures, Dates (Stdlib), DelimitedFiles (Stdlib), Formatting, CodecZlib, Glob, LinearAlgebra (Stdlib), Missings, NaNMath, Pkg (Stdlib), Printf (Stdlib), Serialization (Stdlib).
  2. Data Sets: DataFrames.
  3. Statistics Related: Random, Statistics (Stdlib), and StatsBase (which has many more statistics).
  4. MV Statistics: GLM and Loess (for regressions and smoothing), Distributions (for any types of statistical work)
  5. Graphics and Plotting: Plots

You may as well install the most important packages first. Just cut and paste this into the REPL (the REPL is smart enough to ignore the julia> at the start of the lines):

[download only julia statements]
julia> using Pkg			## load package manager
julia> cookingessentials1 = [
julia> Pkg.add.( cookingessentials1 );	## do not forget the dot after add!
julia> Pkg.API.precompile()	## will eventually become Pkg.precompile()

Other perhaps less essential packages, and used mostly in the second part of the book, are

[download only julia statements]
julia> cookingmore= [ "Blink", "Clp", "CovariancesMatrices", "Feather",
	"FixedEffectModels", "ForwardDiff", "Gallium", "IntervalArithmetic",
	"IntervalRootFinding", "Ipopt", "JLD", "JuMP", "LaTeXStrings",
	"LsqFit", "Measures", "NLopt", "NLsolve", "ORCA", "PlotlyJS",
        "PyPlot", "RDatasets", "SIMD", "SQLite", "StackFrames",
        "StaticArrays", "TimeSeries", "TimerOutputs", "TraceCalls" ]


Useful Packages on Julia Repository


  • Another introduction to packages is at here.
  • Revise.jl sometimes prevents the need to quit and restart. This can be handy when big packages (like DataFrames) are loaded.
  • The lack of clear endorsement of packages is a shortcoming of Julia. Users still have to research or guess what packages are “for real” and what was an experiment that someone put on the julia repository and has since abandoned. R also has a nice task view that Julia still lacks.


packages.txt · Last modified: 2018/12/27 13:27 (external edit)