Cmdstanr processx_exec Error

I am trying to run a model from the rethinking package, but am getting the following error:

Error in process_initialize(self, private, command, args, stdin, stdout, …:
! Native call to processx_exec failed
Caused by error in chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …:
! create process ‘ulam_cmdstanr_26394daa2cfa2ded9eea3abe7aa8d8c2.exe’ (system error 5, Access is denied.
) @win/processx.c:1040 (processx_exec)

Here is my code, though I suspect this is a cmdstanr issue on the backend after looking at other threads. So far, nothing I’ve tried from other threads has worked.

library(rethinking)

data(WaffleDivorce)
d = WaffleDivorce

d$D = standardize(d$Divorce)
d$A = standardize(d$MedianAgeMarriage)
d$M = standardize(d$Marriage)

# multivariate model
m5.3 = ulam(
  alist(
    D ~ dnorm(mu, sigma),
    mu <- a + bM*M + bA*A,
    a ~ dnorm(0, 0.3),
    bM ~ dnorm(0, 0.5),
    bA ~ dnorm(0, 0.5),
    sigma ~ dexp(1)),
  data = list(D = d$D,
              A = d$A,
              M = d$M))
  • Operating System:
    Edition Windows 10 Enterprise
    Version 21H2
    Installed on ‎8/‎18/‎2022
    OS build 19044.2486
    Experience Windows Feature Experience Pack 120.2212.4190.0

  • CmdStan Version: 2.31.0

  • Compiler/Toolkit: Rtools4.2

Thank you for any help!

The Access is denied part of your error message suggests that you are working on a corporate/organisation machine and you do not have permission to run arbitrary executables (e.g., compiled cmdstan models).

If you are not able to have this access privilege granted by your IT department, you will have to use rstan instead of cmdstanr as the backend (as rstan does not create and run external executables)

Thank you. Yes. This is the problem. My organization has asked if I can change where the temp folders are created. Is that possible? In searching, I assume that cmdstanr_write_stan_file_dir = "newpath" is the solution, but it has not worked so far.

Did you find any solution to be able to use CmdStan? I’m having the same issue on my work computer… Thanks!