Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with compiling mixutre models on Windows (rstantools 2.3.0) #107

Closed
isaacvock opened this issue Mar 14, 2023 · 4 comments
Closed

Comments

@isaacvock
Copy link

isaacvock commented Mar 14, 2023

I am working on submitting a new release of an R package that uses rstan to CRAN, but rstantools 2.3.0 seems to have caused problems compiling some of the package's Stan models on Windows machines. In particular, it seems like any model containing log_mix(...) leads to a problem. I was able to build the package with pkgbuild::compile_dll() and rstantools 2.3.0 on a Mac and Linux OS, but not on my Windows machine (Windows 11 version 21H2; R version 4.2.1; rstan version 2.26.13; Rcpp 1.0.9; rstantools 2.2.0; and Rtools 4.2). Below is a screenshot of the output of .Last.error that arises when running pkgbuild::compile_dll() inside the package's root directory.

bakR_compile_error

Running devtools::check_win_release() on the Mac system I was able to successfully build the package on yields the same error. I also tested building a new R package using rstan from scratch on my Windows machine following the instructions here, which worked until I added a Stan model to inst\stan containing a call to log_mix(...). In particular, I tried adding the stan models named MCMC.stan and Mutrate_est2.stan in my package's inst/stan directory. Adding the stan model named Hybrid.stan, which does not contain a call to log_mix() but is otherwise identical to the MCMC.stan model did not yield any problems when building the test package with pkgbuild::compile_dll.

@andrjohns
Copy link
Collaborator

Your version of rstan 2.26.x is out of date :

Windows 11 version 21H2; R version 4.2.1; rstan version 2.26.13; Rcpp 1.0.9; rstantools 2.2.0; and Rtools 4.2

The latest 2.26.x version is 2.26.17. Can you try updating and then try your compilation again?

@isaacvock
Copy link
Author

Will do! Though I might misunderstand how devtools::check_win_release() works, but I assumed that would test it on the CRAN release version of rstan? If that's the case then getting the error with that version is concerning if I want to make it past CRAN checks.

@andrjohns
Copy link
Collaborator

Note that when you run devtools::check_win_release() it will still first build the package locally against your installed dependencies so that it can build the package vignettes. I believe that once you've updated your rstan version (or reverted to the CRAN version), you will no longer get an error

@isaacvock
Copy link
Author

isaacvock commented Mar 14, 2023

That makes sense, though I ran check_win_release() on the Mac that had didn't have any problems building the package with compile_dll, but I now realize that failure was because a non-required package used in one of the vignettes was not installed on that system (whoops). Updating to the most recent rstan version did solve the build issues on my Windows machine and it passed check_win_release()! Thank you for your quick and helpful responses, I will work on submitting to CRAN asap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants