CmdStanR 0.5.2 + R4.2 (W11): CmdStan installation error

Hi,

Installing CmdStan from CmdStanR (0.5.2) with R4.2 (on Windows 11) fails when you manually specify the install directory (whether using the dir argument or changing the value of Sys.getenv("HOME") beforehand).

Edit: It also fails when not specifying a directory for the install …

cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(dir = "D:/Dev/SDK/.cmdstan")

Console output:

The C++ toolchain required for CmdStan is setup properly!
* Latest CmdStan release is v2.29.2
* Installing CmdStan v2.29.2 in D:/Dev/SDK/.cmdstan/cmdstan-2.29.2
* Downloading cmdstan-2.29.2.tar.gz from GitHub...
* Download complete
* Unpacking archive...
Warning: cannot open file 'D:/Dev/SDK/.cmdstan/cmdstan-2.29.2/make/local': No such file or directory

If I look at the directory structure of the unpacked archive (from the install attempt), the issue seems to be that ‘cmdstan-2.29.2’ is repeated twice in the path: the content of CmdStan is located at ‘D:/Dev/SDK/.cmdstan/cmdstan-2.29.2/cmdstan-2.29.2/’, which would explain why the make/local is not found …

P.S: I’ve had issues installing CmdStan from CmdStanR for a while (I already had problems while I was still on W10, starting around CmdStan version 2.27 IIRC). Until now, I temporarily “solved” it by manually fetching the latest CmdStan archive, untar-ing, and using rebuild_cmdstan on that. But since R4.2, using that technique results in an unusable CmdStan install: every model fails to build. Since CmdStanR v0.5.2 is supposed to work with R 4.2, I’m guessing that the problem comes from the roundabout way I do the installation, hence why I am now seeking answers.

Thanks in advance :)

Edit: it seems the issue is also present when I let CmdStanR install in the default directory (same issue of repeating “cmdstan-2.29.2”), which was not the case back when I first encountered this error, AFAIR. Edited title to reflect that.

Edit 2: created a GH issue for it: CmdStanR 0.5.2 + R4.2 + W11: CmdStan installation error · Issue #653 · stan-dev/cmdstanr · GitHub

@jonah @rok_cesnovar - This looks like a bug in cmdstanr, assuming make/local exists in the default path rather than the provided path

Should I raise an issue on GH instead of here ? I edited my original post since I re-tried the install with the default dir, and it fails too. This makes me think the issue is either me-specific, or maybe W11 specific, but I doubt I’m the only one using cmdstanr on W11.

I think it might be worth raising on github. I’m not an R expert by any means, but this line

looks like it is calling the make_local function without specifying the directory as the custom-set directory, so that seems like a bug