Unable to install CmdStan on Windows 10 R4.2.2


I am trying to install CmdStan on Windows 10 for R4.2.2 via RStudio.


Describe the issue as clearly as possible.

I have tried the following different ways of installing it:


install.packages(“cmdstanr”, repos = c(“Repository for distributing (some) stan-dev R packages | r-packages”, getOption(“repos”)))

The tool chain is properly set up and I was able to install stan beforehand. I always get the same error (even when trying to install it in a specific directory):

cmdstanr::install_cmdstan(overwrite = T)
The C++ toolchain required for CmdStan is setup properly!

  • Latest CmdStan release is v2.31.0
  • Installing CmdStan v2.31.0 in C:/Users/Wally/Documents/.cmdstan/cmdstan-2.31.0
  • Downloading cmdstan-2.31.0.tar.gz from GitHub…
  • Removing the existing installation of CmdStan…
  • Download complete
  • Unpacking archive…
    /usr/bin/tar: Cannot connect to C: resolve failed
    Error: Problem extracting tarball. Exited with return code: 128
    In addition: Warning message:
    In utils::untar(dest_file, exdir = dir_cmdstan, extras = “–strip-components 1”) :
    ‘tar.exe -xf “C:/Users/Wally/Documents/.cmdstan/cmdstan-2.31.0.tar.gz” -C “C:/Users/Wally/Documents/.cmdstan/cmdstan-2.31.0” --strip-components 1’ returned error code 128

The issue seems to lie with the untar function. I read here (linux - What does `tar: Cannot connect to …: resolve failed` mean? - Super User) that it might have to do with the colon not being read properly. Is this something that can be changed in the underlying code for installing cmdStan. I am able to use 7zip to untar the files manually and then tried to use rebuild_cmdstan to install it manually but that doesn’t work. I guess I am missing some steps in between but I do not know which ones.

Help is greatly appreciated.

I only now saw this post (Problem with cmdstan unpacking - #6 by Joel_Olausson) which solved my issue as well!