Cmdstanr.exe being blocked in the 'Temp' folder, can I specify where the .exe goes?


I am using an institutional computer which blocks programs from placing files into the ‘Temp’ folder. I don’t 100% understand what the .exe file does but my IT help asked if I could direct cmdstanr to place the .exe into another folder.

Is there a way to do this?

Here is the report that our IT department generated.

----Excluded Today
Microsoft Defender Exploit Guard has blocked an operation that is not allowed by your IT administrator.
For more information please contact your IT administrator.
ID: 01443614-CD74-433A-B99E-2ECDC07BFC25
Detection time: 2022-10-20T22:29:38.683Z
User: HU\AHitch
Path: C:\Users\AHitch\AppData\Local\Temp\Rtmpg7psPW\ulam_cmdstanr_a44acff84b689ee2ba7f521acf8bec1e.exe
Process Name: C:\Program Files\RStudio\bin\rsession.exe
Target Commandline:
Parent Commandline:
Involved File:
Inheritance Flags: 0x00000000
Security intelligence Version: 1.377.550.0
Engine Version: 1.1.19700.3
Product Version: 4.18.2209.7

Here is the error that gets thrown when I try to run my model.

Error in rethrow_call(c_processx_exec, command, c(command, args), pty, :
create process ‘ulam_cmdstanr_1430738bdddd5960dd98497d79bba467.exe’ (system error 5, Access is denied.
) @win/processx.c:1040 (processx_exec)

Stack trace:

  1. rethinking:::ulam(alist(pos ~ bernoulli(p), logit(p) ← a_bar + …
  2. mod$sample(data = data, chains = chains, parallel_chains = cores, …
  3. runset$run_cmdstan()
  4. private[run_method]
  5. procs$new_proc(id = chain_id, command = self$command(), args = self$command_args()[[chain_id]], …
  6. withr::with_path(c(toolchain_PATH_env_var(), tbb_path()), private$processes_[[id]] ← wsl_compatible_process_new(command …
  7. base:::force(code)
  8. cmdstanr:::wsl_compatible_process_new(command = command, args = args, …
  9.$new, run_args)
  10. (function (…) …
  11. processx:::initialize(…)
  12. processx:::process_initialize(self, private, command, args, stdin, …
  13. rethrow_call(c_processx_exec, command, c(command, args), pty, …

x create process ‘ulam_cmdstanr_1430738bdddd5960dd98497d79bba467.exe’ (system error 5, Access is denied.
) @win/processx.c:1040 (processx_exec)

I am using the ‘rethinking’ pkg to run my models.

Thanks in advance for your help.

You can use options(cmdstanr_write_stan_file_dir = "some/path") to save the model executables somewhere else.

Thanks Max,
For some reason it didn’t work.

I have this set of code:

options(cmdstanr_write_stan_file_dir = “~/DiseaseSurveillanceAndEcology/Singapore/Cencurut”)

And I got this error when I tried to fit my model:

g++: fatal error: cannot execute ‘C:/rtools42/ucrt64/bin/…/lib/gcc/x86_64-w64-mingw32/12.2.0/cc1plus.exe’: CreateProcess: No such file or directory

compilation terminated.

mingw32-make: *** [make/program:58: C:\Users\AHitch\AppData\Local\Temp\Rtmp4sNHj1\model-7582f931498.exe] Error 1

Error: An error occured during compilation! See the message above for more information.

It still seems like it is placing the executable in my temp folder.

Can you help me decipher this?

Thanks in advance