Skip to content

Getting Started


To use Turing, you need to install Julia first and then install Turing.

Install Julia

You will need to install Julia 1.0 or greater, which you can get from the official Julia website.

Install Turing.jl

Turing is an officially registered Julia package, so the following will install a stable version of Turing while inside Julia’s package manager (press ] from the REPL):

add Turing

If you want to use the latest version of Turing with some experimental features, you can try the following instead:

add Turing#master
test Turing

If all tests pass, you’re ready to start using Turing.


Here’s a simple example showing the package in action:

using Turing
using StatsPlots

# Define a simple Normal model with unknown mean and variance.
@model gdemo(x, y) = begin
  s ~ InverseGamma(2, 3)
  m ~ Normal(0, sqrt(s))
  x ~ Normal(m, sqrt(s))
  y ~ Normal(m, sqrt(s))

#  Run sampler, collect results
chn = sample(gdemo(1.5, 2), HMC(0.1, 5), 1000)

# Summarise results (currently requires the master branch from MCMCChains)

# Plot and save results
p = plot(chn)