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!

I am not sure how relevant this will be to others, but I had a similar error when working with cmdstanr in an RStudio Server instance on a remote machine on Microsoft Azure.

mod <- cmdstan_model(fitmodel)   # compiles model (if necessary)
Model executable is up to date!
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, …`:
! cannot start processx process '/home/cmi/CMI Dropbox/CMI_Team/Analysis/Bayesian_Workflow/Maui_2020/Maui_2020_V02_HAPE/BC5/BC5_mltist' (system error 13, Permission denied) @unix/processx.c:611 (processx_exec)
Type .Last.error to see the more details.

In my case I had a Ubuntu 20.04 VM with the machine size set to some small 4 core VM for testing and getting set up. Everything worked fine. When I resized the VM to a 20 cores i started getting this error. I solved it (finally!) and was tipped off by the message I was getting Model executable is up to date! and my solution was to delete the exe that had been compiled on the old VM and recompile. This fixed my error and the model ran!

I recently installed R 4.4.0 and had the same problem. But problem solved with installing Rtools44.