Cmdstanr Installation error

Hi everyone,

I am trying to install cmdstan in RStudio (RTools40) (Windows 11). I ran the following code:

install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
cmdstanr::install_cmdstan()

but then got this error:

Error: 
Rtools40 installation found but the toolchain was not installed.
Run cmdstanr::check_cmdstan_toolchain(fix = TRUE) to fix the issue.

and thus ran:
cmdstanr::check_cmdstan_toolchain(fix = TRUE)

which led to this error:

Error in processx::run("pacman", args = c("-Sy", install_pkgs, "--noconfirm"),  : 
  System command 'pacman' failed, exit status: 1, stderr:
E> error: failed retrieving file 'rtools.db' from dl.bintray.com : The requested URL returned error: 502
E> error: failed to update rtools (unexpected error)
E> error: failed retrieving file 'mingw32.db' from dl.bintray.com : The requested URL returned error: 502
E> error: failed to update mingw32 (unexpected error)
E> error: failed retrieving file 'mingw64.db' from dl.bintray.com : The requested URL returned error: 502
E> error: failed to update mingw64 (unexpected error)
E> error: failed to synchronize all databases

and this traceback:

Stack trace:

 1. cmdstanr::check_cmdstan_toolchain(fix = TRUE)
 2. cmdstanr:::check_rtools4x_windows_toolchain(fix = fix, quiet = quiet)
 3. cmdstanr:::install_toolchain(quiet = quiet)
 4. withr::with_path(c(toolchain_PATH_env_var()), processx::run("pacman",  ...
 5. base:::force(code)
 6. processx::run("pacman", args = c("-Sy", install_pkgs, "--noconfirm"),  ...
 7. throw(new_process_error(res, call = sys.call(), echo = echo,  ...

 x System command 'pacman' failed, exit status: 1, stderr:
E> error: failed retrieving file 'rtools.db' from dl.bintray.com : The requested URL returned error: 502
E> error: failed to update rtools (unexpected error)
E> error: failed retrieving file 'mingw32.db' from dl.bintray.com : The requested URL returned error: 502
E> error: failed to update mingw32 (unexpected error)
E> error: failed retrieving file 'mingw64.db' from dl.bintray.com : The requested URL returned error: 502
E> error: failed to update mingw64 (unexpected error)
E> error: failed to synchronize all databases ```


I tried to fix by following similar issues on the forums to no avail. 

Thanks for any help you can provide.
1 Like

I have exactly the same problem.
Did you have a solution?

At least this issue is solved for me by following this Error in building CmdStanr on Windows 10 - #23 by rok_cesnovar