Error installing cmdstan

I’m trying to install cmdstan (Windows 10, RStudio 2021.09.1, R 4.1.2)

I installed cmdstanr from github

devtools::install_github("stan-dev/cmdstanr")

The toolchain is correctly setup to install cmdstan

> cmdstanr::check_cmdstan_toolchain(fix=TRUE)
The C++ toolchain required for CmdStan is setup properly!

I tried specifying the directory as suggested here but I get the following error:

> install_cmdstan(cores=2, dir="C:/Users/yim583")
The C++ toolchain required for CmdStan is setup properly!
* Latest CmdStan release is v2.28.2
* Installing CmdStan v2.28.2 in C:/Users/yim583/cmdstan-2.28.2
* Downloading cmdstan-2.28.2.tar.gz from GitHub...
* Download complete
* Unpacking archive...
stan/lib/stan_math/lib/benchmark_1.5.1/docs/tools.md: truncated gzip input
tar.exe: Error exit delayed from previous errors.
Error: Problem extracting tarball. Exited with return code: 1
In addition: Warning message:
In utils::untar(dest_file, exdir = dir_cmdstan, extras = "--strip-components 1") :
  ‘tar.exe -xf "C:/Users/yim583/cmdstan-2.28.2.tar.gz" -C "C:/Users/yim583/cmdstan-2.28.2" --strip-components 1’ returned error code 1

I also have a working tar

> system("tar.exe")
tar.exe: Must specify one of -c, -r, -t, -u, -x
[1] 1

Are you able to open the downloaded file in your user directory with some other tool (7zip for example)? It might be a corrupted download, but if re-running continues to have errors then I’m not so sure. @rok_cesnovar is this error familiar?

Pozdrav Benjamin,

I would say this is the case here. Based on truncated gzip input. Maybe try downloading the cmdstan tarball manually? Is AWS/Github having issues again maybe?

1 Like

Hvala Rok. Where to download the tarball manually from? Is this best?
https://github.com/stan-dev/cmdstan/releases/download/v2.28.2/cmdstan-2.28.2.tar.gz

Yeah, the downloaded tar should have around 48MB. Then unzip that to a folder and point cmdstanr to it:

set_cmdstan_path("the/new/folder)
rebuild_cmdstan(cores = X) # set X to 4 or 2
1 Like