Cmdstanr can't find makefile after installation...suspect network path problem

Well, after successfully installing cmdstanr on my work windows 10, I’m having issues with the path. I suspect it has something to do with my path directory being a network drive.

When I try to run the following code, f, and fit are correctly created

library(rethinking)

f <- alist(
  y ~ dnorm( mu , sigma ),
  mu ~ dnorm( 0 , 10 ),
  sigma ~ dexp( 1 )
)

fit <- quap( 
  f , 
  data=list(y=c(-1,1)) , 
  start=list(mu=0,sigma=1)
)

But when I run the following:

fit_stan <- ulam( f , data=list(y=c(-1,1)) )

I get the following error:

Error: CmdStan path has not been set yet. See ?set_cmdstan_path.

The path is set, however (actually…this wasn’t the error I was receiving after installation…I didn’t capture the error but it was something like cmdstan couldn’t find the right makefile).

file.path(Sys.getenv(“HOME”), “.cmdstan”)
[1] “//S-N-NSCHOME/nschomes/UID/Documents/.cmdstan”

That directory contains the directory cmdstan-2.31.0, which contains the makefile.

I suspect it has something to do with that location being on the network.

I have access to the C:drive, but I’m not sure how to force install_cmdstan to go there.

I have read a lot of these sorts of struggles but none seem to be what I need. Advice is appreciated

I realize the question is stale, but in the future when you run into this issue (or if you’re still struggling with it) you can run cmdstanr::set_cmdstan_path() and get the path that is currently set.

Since the function is just in plain R you can also run cmdstanr::set_cmdstan_path (without parens) and you’ll get the R code for the checks that cmdstanr is actually running to see if the directory is valid.

If you set options(error=recover) before your ulam call you should get a backtrace that tells you if it’s a cmdstanr function that fails to find the directory or something from ulam itself… I’m not familiar with ulam.

2 Likes