I am having trouble getting rstan to function on a windows 10 machine. I have followed all instructions found on https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows. I installed R 3.4.3, Rstudio 1.1.423, and Rtools33 first and then followed the steps in the link. Rtools comes up fine in the path.
When I try (as recommended in the link):
fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '
return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
' )
fx( 2L, 5 ) # should be 10
I get the following error:
Error in system(cmd, intern = !verbose) : 'C:/Program' not found
I found and followed a very similar thread on this forum that talked about adding quotation marks around whatever is assigned to CXXFLAGS in the Makevars file. This made no difference so I changed it back to no quotation marks.
Note my makevars file contains the following line:
I have tried uninstalling R, Rstudio, Rtools and reinstalling them and following the steps again and no change in the problems. I have followed the exact same process on a different windows 10 machine and had no issues, just the computer I need to use at work is giving me this trouble.
If I try to use any rstan function, I get the
Error in system(cmd, intern = !verbose) : 'C:/Program' not found.
Any ideas on what I am missing? What other info can I provide to help diagnose this?
Thanks
Especially see this part: âIf you want to be able to build packages from sources, we recommend that you choose an installation path not containing spaces.â
The other system I got working had Rtools33, etc the same as this machine and there were no problems. So, the Rtools version doesnât seem to be the problem. I mainly am interested in running rstan functions like stan(âlogit.stanâ, data = standata). Thanks for the link, though it seems to be addressing a different issue and need. Hmmm, not sure what else to tryâŚ
How is it a different issue? Itâs the very same error message: âError in system(cmd, intern = !verbose) : âC:/Programâ not foundâ.
Yes, it is for Rcpp, but RStan uses Rcpp. Also, itâs an error message that indicates that something is trying to run something in âC:/Program Filesâ, and that something fails because it treats âC:/Programâ and âFilesâ as separate tokens, thus mistaking âC:/Programâ for a program to execute rather than treating it as part of a path to, say, g++.
One possibly useful note: I do not have admin priveleges on this machine, so I have to get IT help to install or uninstall things. I ran across a comment in the post that jjramsey recommended that talks about permission maybe causing this kind of problem, it said:
@edouard That command was intended to identify, not fix the problem. Rather than displaying it as an answer, it makes more sense to include the output as an update to your question. Also, given that the error shows that it could not write the error file, I suspect that R does not have permission to write to the C:/Program Files/R-3.0.1/bin/x64/R directoryâŚ
Would running Rstudio as administrator once possibly help?
Thanks bgoodri, I will try your suggestions. It may be next week before I get help from the IT admin people. I will post whatever ends up working, hopefully something.
I adjust my .Rprofile because Rtools was installed to Program Files. My .Rprofile has the line:
Sys.setenv(BINPREF = âC:/PROGRA~1/Rtools/mingw_$(WIN)/bin/â)
I think both R and RTools both get installed under C:\Program Files by default. The installation guide for Windows is somewhat annoying by assuming they are under C:.
Wanted to update this. I did nothing new after my last attempt as far as uninstall reinstall. The IT people recently updated my windows 10 to the newest version. Another thing that had not been done was windows 10 had not been activated yet before due to an error not allowing it. So after the update, they tried activating windows and got it to go through. Anyway, not sure whether the activation or the update or both made the difference, (I suspect the activation) but rstan and rstanarm work now with no issues. I did have rstan uninstalled during the update and then just install.packages(ârstanâ) after it and all set.
Thanks for reporting back and glad to hear things are now working. Weâre often in this situation where some bit of infrastructure changes and then broken RStan or PyStan installs work again for reasons we never fully understand.
We had a similar issue with Windows 7. Oddly enough, the installation of RStan was not problematic on some laptops yet failed on others despite very similar environments (Windows 7, R 3.5.1, RStudio 1.1.453, Rtools 3.4.0.1962) with a similar message as the original post in this thread (âC:/Programâ not found).
R was installed to the default directory c:/Program files/R. The laptops on which everything worked fine showed 8dot3 shortnames (so for instance C:\PROGRA~1\R) when the command dir /x was executed in a DOS prompt at c:/. In other cases this was missing.
The following workaround was successful:
open a DOS terminal
Type: mklink /J "C:\PROGRA~1" "C:\Program Files" and press enter (this will create a directory junction from C:\PROGRA~1 to C:\Program Files, which will be visible in the windows explorer) (see also this link)
Open RStudio
Go to Tools - Global Options and click Change R-version in the General tab.
Click âChoose a specific version of Râ and click on browse.
Copy paste C:\PROGRA~1\R in the destination folder. Click further to the map containing your most recent R version (R-x.y.z).
In the screen that pops up choose 64-bits R version (or 32-bits)
Click Apply and restart Rstudio
After that, RStan and brms worked fine (after install.packages(ârstanâ)).
I hope someone points this to the root cause of the problem⌠maybe @bgoodri? I guess it has nothing to do with rstan, but rather the interaction between Rstudio and Rtools?