# Problem using rstan

**URL:** <https://discourse.mc-stan.org/t/problem-using-rstan/2731>\
**Category:** Interfaces\
**Created:** [December 11, 2017, 6:51pm UTC](https://discourse.mc-stan.org/t/problem-using-rstan/2731 "2017-12-11T18:51:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pviton](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@pviton](https://discourse.mc-stan.org/u/pviton)\
**Post date:** [December 11, 2017, 6:51pm UTC](https://discourse.mc-stan.org/t/problem-using-rstan/2731/1 "2017-12-11T18:51:19Z")

</div>

Can anyone suggest what might be going wrong here?

Operating system: Win 7  
R version: R-3.2.4.  
rstan version: 2.15.1  
rtools version: 3.2.0.1948

A. I’ve had stan/Rstan running for a long time on  
this computer. When I’m logged in I can  
successfully compile/run a script that sets up and  
runs the famous 8schools example under RStudio.

B. I recently added a second user – also an administrator –  
to the system. However, when I try to run the same 8schools  
script when logged in as this user, I consistently get an error:

> fit\<- stan(file=“8schools.stan”,

- 

```
        data=stan_data,iter=2000, chains=4, cores=cores)

```

Error in file(con, “r”) : cannot open the connection  
In addition: Warning messages:  
1: running command ‘C:/PROGRA~4/R/R-32~1.4/bin/x64/R CMD SHLIB file1785a23362d.cpp 2\> file1785a23362d.cpp.err.txt’ had status 65535  
2: In file(con, “r”) :  
cannot open file ‘file1785a23362d.cpp.err.txt’: No such file or directory

This occurs with all other scripts too; not just  
8schools. So far I’ve checked that the second user:

- has RTools appropriately in the path
- that system(‘g++ -v’) produces the expected output ; as does system(‘where make’)
- can write to each directory in the RTools folder (if that matters)
- can run z\<-stanc(file=“8schools.stan”) apparently without error.

Also, the same problem arises in the default Rgui, so it doesn’t seem to be an RStudio problem.

Can anyone suggest what is going wrong here? Where is the .cpp file being written to? Could that be an issue? Is it possible that rstan has “learned” to use some folders that apply only to the first user, and which may be unavailable to the second user (eg the location of first user’s the TEMP/TMP folder)?

Thanks for any help/suggestions!

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [December 11, 2017, 7:04pm UTC](https://discourse.mc-stan.org/t/problem-using-rstan/2731/2 "2017-12-11T19:04:44Z")

</div>

Google for `status 65535`. There are many hits related to R. It may be that the slashes in the path to the compiler or the temporary directory or something are pointing the wrong direction.

---

<div class="post-metadata">

**Author:** ![pviton](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@pviton](https://discourse.mc-stan.org/u/pviton)\
**Post date:** [December 12, 2017, 6:21pm UTC](https://discourse.mc-stan.org/t/problem-using-rstan/2731/3 "2017-12-12T18:21:13Z")

</div>

I don’t think that can be it. RTools installs its location into the system path, so that the old and new users are seeing the same path elements. Same thing for the temp directories: these are set up by Windows, so the slashes for both users point in the same direction.

---

<div class="post-metadata">

**Author:** ![Islam\_Siam](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@Islam\_Siam](https://discourse.mc-stan.org/u/Islam_Siam)\
**Post date:** [July 9, 2018, 7:33pm UTC](https://discourse.mc-stan.org/t/problem-using-rstan/2731/4 "2018-07-09T19:33:20Z")

</div>

Hellow pviton, could you please tell me if you find solution for this problem. I have the same. I fed up
