Virus warning

Hi Nels, that’s very strange, thanks for letting us know. I definitely don’t think there’s a virus (or at least it didn’t come from RStan if you actually do have a virus), so I don’t know why you’re getting this message. According to https://ugetfix.com/ask/how-to-fix-operation-did-not-complete-successfully/:

There are three possible reasons you are seeing the Operation did not complete successfully error:
-The executable you just downloaded is actually infected with malware;
-Windows Defender or other security software is set to a maximum protection mode;
-It is a false-positive scan result from the AV vendor;

although I don’t know how reliable that site it.

One thing you can try is switching from using the stan() function to using stan_modlel() and sampling(), which does the same thing but splits it into a compile step and a sampling step. This is especially relevant when running RStan in a loop because of issues like this: Error in dyn.load(libLFile) - #2 by jonah. It’s possible that something related to that error is also at play here although I’m not 100% sure.

So if you’re running RStan in a loop I would use stan_model() once to compile your model outside the loop, and then inside the loop you can use sampling() repeatedly. For example:

mod <- stan_model(file)
for (j in 1:J) {
  fit <- sampling(mod, data, chains, ...) # etc.
}
2 Likes