Skip to content

DynamicPPL not defined in Main error when sampling from model with .~ expression #868

@tiemvanderdeure

Description

@tiemvanderdeure

Minimal working example

using Turing
@model function coinflips(y)
    p ~ Beta(1, 1)
    y .~ Bernoulli(p)	
end
m = coinflips(rand(Bool, 100))
sample(m, NUTS(), 1000)

Description

This triggers a

ERROR: UndefVarError: `DynamicPPL` not defined in `Main`

within the replace_returns macro.

Just running using Turing.DynamicPPL fixes this error.

Julia version info

versioninfo()
Julia Version 1.11.3
Commit d63adeda50 (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, tigerlake)
Threads: 7 default, 0 interactive, 3 GC (on 8 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 7

Manifest

]st --manifest
(Paste here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions