Cmdstanr Access Denied - Processx failure

Hi all -

I am having some trouble with cmdstanr and the compilation of code. This is an error that has been discussed previously here. When I try to compile a model mod <- cmdstan_model(...) I get the same error as the linked page.

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 'D:/Projects/AABA2024/analyses/code/probit_cop.exe' (system error 5, Access is denied.
) @win/processx.c:1040 (processx_exec)
Type .Last.error to see the more details.

I know the access denied portion is tied to permissions to run arbitrary executables. The issue is I am an admin on the machine - I have full read,write,edit, etc. access to files on my machine (although I am still working on a “university-imaged” desktop. What is even weirder - when I run the above function, the .exe file does show up in the designated folder AND if I exit R and come back and run the same function - mod <- cmdstan_model(...), I recieve no errors and get the normal message executable is up to date.

I have wracked my brain and I for the life of me cannot figure out what is going on here. Any suggestions from the community or devs?

The processes are being launched via R, so they only have the permissions that R itself has. You probably need to launch R with admin privileges if you need R to initiate processes that also have admin privileges

@andrjohns No such luck.

I’ve also gone through and given ‘full control’ to R, Rstudio, Rtools, etc. (Probably overkill?).

But - same Access is Denied.

I’m unsure where to turn to next.

Any difference if you try launching R by right-clicking and selecting “Run as Administrator”?

No difference.

I even ran the R gui followed by Rstudio as an admin - both times resulted in the Access is Denied warning.

And to double-check, are you able to compile and run the model via the command line (i.e., through plain cmdstan)?

@andrjohns Apologies for the delayed response.

The short answer is no. I was able to compile the example
mingw32-make examples/bernoulli/bernoulli.exe

But, when I fit:
./examples/bernoulli/bernoulli.exe sample data file=examples/bernoulli/bernoulli.data.json

I have a similar error bash: ./examples/bernoulli/bernoulli.exe: Permission denied.

It looks like you’ll need to contact your IT department for instructions on adding permissions for running arbitrary executables. There’s not really anything we can do from the cmdstan/cmdstanr side unfortunately

1 Like

Totally okay - Now if only the IT department had a better idea of how to help. They seem to be lost at the moment…

Thanks Andrew!

Just filling you in on the update for any future issues that may arise for others-

It is related to the antivirus software through the university and I found it after going through Window’s Defender protection history. It reads as follows:

App or process blocked: "mod.exe"
Blocked by: Attack Surface Reduction

Rule: Block executable files from running unless they meet a prevalence, age, or trusted list criteria

Now IT is arguing there is nothing they can do because the security policy is set “company-wide”…

Thanks for the help!