Hit a weird issue this morning where my path is set but when I try to build a model it tells me it isn't:
> library(cmdstanr)
This is cmdstanr version 0.2.0
- Online documentation and vignettes at mc-stan.org/cmdstanr
- CmdStan path set to: /home/bbales2/.cmdstanr/v2.25.0-rc1
- Use set_cmdstan_path() to change the path
> mod = cmdstan_model("bee.stan")
Compiling Stan program...
Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
> cmdstan_path()
[1] "/home/bbales2/.cmdstanr/v2.25.0-rc1"
> set_cmdstan_path(cmdstan_path())
CmdStan path set to: /home/bbales2/.cmdstanr/v2.25.0-rc1
> mod = cmdstan_model("bee.stan")
Compiling Stan program...
Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
That folder exists on my computer and appears to have a cmdstan in it.
We debugged this with Ben in a chat. The problem was in the -rc release. Guess I can close?
Well I'd prefer it keeps running and spits out a warning or something.
I suppose an error would be better than just not working with cmdstan missing.
Why did the rc work in the first place, for instance? When rc 2.26-rc1 comes along will it work?
Weird, I didn't have any issue using the previous release candidate with cmdstanr. What did you figure out when debugging this?
The was the output of some more commands:
> set_cmdstan_path(cmdstan_path())
CmdStan path set to: /home/bbales2/.cmdstanr/v2.25.0-rc1
> cmdstanr:::.cmdstanr$PATH
[1] "/home/bbales2/.cmdstanr/v2.25.0-rc1"
> cmdstanr:::.cmdstanr$VERSION
character(0)
> cmdstanr:::read_cmdstan_version("/home/bbales2/.cmdstanr/v2.25.0-rc1")
character(0)
Hmm the path you have is
/home/bbales2/.cmdstanr/v2.25.0-rc1
but by default cmdstanr would use
/home/bbales2/.cmdstanr/cmdstan-2.25.0-rc1
That said, your version should still work because we want to allow you to set the path to wherever you want, but maybe the difference is causing the error? I haven't dug into the code so I'm not sure, but it's a possibility.
The problem was in the -rc release. Guess I can close?
I think we should keep it open because don't we want it to work with release candidates too?
/home/bbales2/.cmdstanr/v2.25.0-rc1
Good catch. I checked again and that folder does exist and contains stuff though.
Yes, we should come to the bottom of this, but I honestly think was installed with a tarball that was later scratched because it either had the wrong name or something. We had a few times where we made a tarball but quickly saw it had the wrong name or some of the release replace-text procedures went wrong and we quickly replaced it.
I tried installing it locally on a Ubuntu/Windows and it works fine.
@bbbales2 can you check CMDSTAN_VERSION inside the Makefile in that folder?
Actually run the following and let me know where it breaks:
path <- "/home/bbales2/.cmdstanr/v2.25.0-rc1"
makefile_path <- file.path(path, "makefile")
if (!file.exists(makefile_path)) {
warning(
"Can't find CmdStan makefile to detect version number. ",
"Path may not point to valid installation.",
call. = FALSE
)
return(NULL)
}
makefile <- readLines(makefile_path)
version_line <- grep("^CMDSTAN_VERSION :=", makefile, value = TRUE)
sub("CMDSTAN_VERSION := ", "", version_line)
It appears to not have a CMDSTAN_VERSION:
grep("^CMDSTAN_VERSION :=", makefile, value = TRUE) returns character(0)
Yeah, that was a botched RC release try then and that was updated immediately. You were an early tester :) We rely on CMDSTAN_VERSION being there. If it isn't, we cant do anything else.
In that case I'm not worried about this and I think we can close it. Although maybe we should add a check for this to read_cmdstan_version(). Something like this?
if (length(version_line) == 0) {
stop("CmdStan makefile is missing a version number.", call. = FALSE)
}
Let's add that. Would serve as a release-checker as well.