stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.03k stars 264 forks source link

Error in sampler$call_sampler(args_list[[i]]) : c++ exception (unknown reason) #973

Open idontgetoutmuch opened 2 years ago

idontgetoutmuch commented 2 years ago

Summary:

model <- brm(formula = Y ~ X, data = dfTemq, seed = 123) Compiling Stan program... Start sampling

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 1). Chain 1: Chain 1: Gradient evaluation took 2.7e-05 seconds Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.27 seconds. Chain 1: Adjust your expectations accordingly! Chain 1: Chain 1: [1] "Error in sampler$call_sampler(args_list[[i]]) : " [2] " c++ exception (unknown reason)"
error occurred during calling the sampler; sampling not done

Description:

See above

Reproducible Steps:

See above. I am on

R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin20.4.0 (64-bit)
System Version: macOS 11.5.1 (20G80)
Kernel Version: Darwin 20.6.0

Current Output:

See above

Expected Output:

> model <- brm(formula = Y ~ X, data = dfTemq, seed = 123)
Compiling Stan program...
Start sampling

RStan Version:

> packageVersion("rstan")
[1] ‘2.26.3’

R Version:

> R.version.string
[1] "R version 4.1.1 (2021-08-10)"

Operating System:

macOS 11.5.1
D-Berg commented 2 years ago

I get a similar problem when adding the control argument to the stan function. I get the following error:

SAMPLING FOR MODEL 'spline_reg' NOW (CHAIN 1).
[1] "Error in sampler$call_sampler(args_list[[i]]) : "            
[2] "  VECTOR_ELT() can only be applied to a 'list', not a 'NULL'"
error occurred during calling the sampler; sampling not done

R version 4.1.1 (2021-08-10) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Monterey 12.0.1

a-hurst commented 2 years ago

I get a similar problem when adding the control argument to the stan function. I get the following error:

SAMPLING FOR MODEL 'spline_reg' NOW (CHAIN 1).
[1] "Error in sampler$call_sampler(args_list[[i]]) : "            
[2] "  VECTOR_ELT() can only be applied to a 'list', not a 'NULL'"
error occurred during calling the sampler; sampling not done

R version 4.1.1 (2021-08-10) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Monterey 12.0.1

Yep, same here too on Monterey and aarch64.

a-hurst commented 2 years ago

Just as a quick update for the developers and for any similarly confused users, this bug no longer occurs when using the latest experimental version of RStan compiled from GitHub.

To install the experimental branch yourself, just run:

remove.packages(c("rstan", "StanHeaders"))
remotes::install_github("stan-dev/rstan", ref = "experimental", subdir = "StanHeaders")
remotes::install_github("stan-dev/rstan", ref = "experimental", subdir = "rstan/rstan")

This also has the added benefit of a much newer version of Stan on the backend.