Open peclayson opened 2 years ago
This issue gave me an excuse to tinker with R code in a way that I haven't before. I typically write packages in MATLAB, not R. So, debugging libraries is new to me. I also read #3, which had similar issue.
I couldn't see in the script how stan_code_path
would be set when isFALSE(check_for_model("model_threads.exe", path))
is FALSE, because it finds the model file.
I changed ....
if (isFALSE(check_for_model("model.stan", path))) {
stan_code_path <- cmdstanr::write_stan_file(code = stan_code,
dir = paste0(path, "/stan_model"), basename = "model")
}
to
if (isFALSE(check_for_model("model.stan", path))) {
stan_code_path <- cmdstanr::write_stan_file(code = stan_code,
dir = paste0(path, "/stan_model"), basename = "model")
} else if (check_for_model("model.stan", path) & isFALSE(exists("stan_code_path"))) {
stan_code_path <- file.path(path, "stan_model", "model.stan")
}
That seems to make things work for me. It's possible I am missing something on a larger scale than this one script though.
Again, I wonder whether having to use ctrl + C
over the stop button in Rstudio has something to do with me getting this error. I'm not sure.
I am on Win10 and hitting the same issue. Rerunning the vignette model gives me:
Error in cmdstanr::cmdstan_model(stan_file = stan_code_path, cpp_options = list(stan_threads = TRUE)) : object 'stan_code_path' not found
Tinkering with different path settings has not helped.
I tried the same vignette code under WSL2/Ubuntu and the issue still persists with package version 0.1.1
Edit: Thanks for the package! I am sure it will help me insanely...
George
This issue gave me an excuse to tinker with R code in a way that I haven't before. I typically write packages in MATLAB, not R. So, debugging libraries is new to me. I also read #3, which had similar issue.
I couldn't see in the script how
stan_code_path
would be set whenisFALSE(check_for_model("model_threads.exe", path))
is FALSE, because it finds the model file.I changed ....
if (isFALSE(check_for_model("model.stan", path))) { stan_code_path <- cmdstanr::write_stan_file(code = stan_code, dir = paste0(path, "/stan_model"), basename = "model") }
to
if (isFALSE(check_for_model("model.stan", path))) { stan_code_path <- cmdstanr::write_stan_file(code = stan_code, dir = paste0(path, "/stan_model"), basename = "model") } else if (check_for_model("model.stan", path) & isFALSE(exists("stan_code_path"))) { stan_code_path <- file.path(path, "stan_model", "model.stan") }
That seems to make things work for me. It's possible I am missing something on a larger scale than this one script though.
Again, I wonder whether having to use
ctrl + C
over the stop button in Rstudio has something to do with me getting this error. I'm not sure.
This worked for me as well. Is this project alive? It is an awesome idea, but without this fix it just doesn't work.
I think I might be losing my mind. I'm running into the following error when running the vignette on either Mac or Linux.
The model from the vignette runs and finishes fine as long as I don't terminate it during fitting. However, if I
stop
during fitting and restart the fitting, I run into the error above.The only thing that I can think of that I'm doing differently than the vignette is using
Esc
orcrtl + C
to terminate the fitting process. I don't believe (but I don't know for sure) that usingEsc
is functionally different than the Rstudio stop button... but the button doesn't show up in RStudio for me during the model fitting process.Any recommendations on what I could try?
I will try not to post any more issues for the rest of the month... I just really want to use your package :)
Thanks, Peter