Are you able to install other R packages using remotes::install_github()? For example does this work?
remotes::install_github("stan-dev/loo")
If you get a similar error there then I don’t think is related to CmdStanR and there is probably a more general issue with your windows setup (googling a bit it seems like there are other people who get the error message System command ‘Rcmd.exe’ failed when installing R packages but unrelated to CmdStanR or Stan). Unfortunately I don’t know much about Windows but may @rok_cesnovar has seen this before?
I gave up installing the package in that computer. Instead, I found another laptop which is running window 10 to do the installation (with R4.1.3).
This time I did successfully install cmdstanr. However, I encounter errors installing cmdstan.
install_cmdstan(cores = 2)
Error:
RTools installation found but PATH was not properly set.
Run check_cmdstan_toolchain(fix = TRUE) to fix the issue.
check_cmdstan_toolchain(fix = TRUE)
Installing mingw32-make and writing RTools path to ~/.Renviron …
Error in processx::run(“pacman”, args = c(“-Syu”, “mingw-w64-x86_64-make”, :
System command ‘pacman’ failed, exit status: 1, stderr (last 10 lines):
E> error: failed retrieving file ‘mingw64.db’ from cloud.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed retrieving file ‘mingw64.db’ from cran.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed to update mingw64 (download library error)
E> error: failed retrieving file ‘ucrt64.db’ from r-windows.github.io : SSL certificate problem: unable to get local issuer certificate
E> error: failed retrieving file ‘ucrt64.db’ from cloud.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed retrieving file ‘ucrt64.db’ from cran.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed to update ucrt64 (download library error)
E> error: failed retrieving file ‘mirrors.db’ fro
[…]
Type .Last.error.trace to see where the error occurred
Then i tried to download cmdstan directly from github and set the path with.
set_cmdstan_path(PATH_TO_CMDSTAN)
Errors occur when i try to run some cmdstan function.
file ← file.path(cmdstan_path(), “examples”, “bernoulli”, “bernoulli.stan”)
mod ← cmdstan_model(file)
Compiling Stan program…
Error in rethrow_call(c_processx_exec, command, c(command, args), pty, :
Command ‘mingw32-make.exe’ not found @win/processx.c:982 (processx_exec)
Type .Last.error.trace to see where the error occurred
Updates:
I tried to run the codes below again today but different issue came up.
file ← file.path(cmdstan_path(), “examples”, “bernoulli”, “bernoulli.stan”)
mod ← cmdstan_model(file)
Compiling Stan program…
INFO: Could not find files for the given pattern(s).
Error: An error occured during compilation! See the message above for more information.
I have tried other stan function and encountered the same issue.
Your laptop you used is managed by an organization and you are not the administrator. In this case, you should create the R project and install R in where you have control on (I use C disk for this, a bit risky but you can a back-up on an external storage disk)
After that, everytime you install any packages, you should manually change the library path , for example, to install cmdstanr, you need to execute this code:
“install.packages(“cmdstanr”, lib=“C:/PHUONG-1/SET-UP/R-4.1.3/library”, repos = c(“Repository for distributing (some) stan-dev R packages | r-packages”, getOption(“repos”)))”
Remember the argument lib = you should manually fix it to where you store your R installation.
After installing cmdstanr, now you can install rethinking package by withr::with_libpaths(new=“C:/PHUONG-1/SET-UP/R-4.1.3/library”, devtools::install_github(‘rmcelreath/rethinking’))
Note: in the code, the argument new= needs to be manually changed to your R installation path as above
Good luck! and hope this helps. It helps me and my issues are exactly yours