Cmdstanr unable to sample - chains are always finishing unexpectedly in Linux

Hi there,

This issue is similar to Chains finish unexpectedly in new install of CmdStanR except the problem persists for Ubuntu 22.04. The temporary fix posted works for Windows. Did anyone manage to find a fix for linux ?

The following are the outputs I have received when running examples/bernoulli

cmdstan_path()
[1] “/base_dir/cmdstan”

cmdstan_version()
[1] “2.31.0”

file ← file.path(cmdstan_path(), “examples”, “bernoulli”, “bernoulli.stan”)

mod ← cmdstan_model(file)
Compiling Stan program…
Warning messages:
1: In readLines(hpp_path) :
incomplete final line found on ‘/tmp/RtmpPh2NzG/model-90dd26222f47a.hpp’
2: In readLines(private$hpp_file_) :
incomplete final line found on ‘/tmp/RtmpPh2NzG/model-90dd26222f47a.hpp’

mod$print()
data {
int<lower=0> N;
array[N] int<lower=0,upper=1> y;
}
parameters {
real<lower=0,upper=1> theta;
}
model {
theta ~ beta(1,1); // uniform prior on interval 0,1
y ~ bernoulli(theta);
}

mod$exe_file()
[1] “/cmdstan_base_dir/examples/bernoulli/bernoulli”

fit ← mod$sample(data = “/cmdstan_base_dir/examples/bernoulli/bernoulli.data.json”, seed = 123, chains = 6, parallel_chain
s = 6, refresh = 100, output_dir = “/cmdstan_base_dir/examples/bernoulli”, output_basename=“out”)
Running MCMC with 6 parallel chains…

Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3 Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4 Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 5 Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 6 Iteration: 1 / 2000 [ 0%] (Warmup)
Warning: Chain 1 finished unexpectedly!

Warning: Chain 2 finished unexpectedly!

Warning: Chain 3 finished unexpectedly!

Warning: Chain 4 finished unexpectedly!

Warning: Chain 5 finished unexpectedly!

Warning: Chain 6 finished unexpectedly!

Warning: Use read_cmdstan_csv() to read the results of the failed chains.
Warning messages:
1: All chains finished unexpectedly! Use the $output(chain_id) method for more information.

2: No chains finished successfully. Unable to retrieve the fit.