Rstantools rstan_package_skeleton() failing with "Error in getDLLRegisteredRoutines.DLLInfo"


#1

I’m trying to follow the vignette on creating a package that depends on RStan: http://mc-stan.org/rstantools/articles/minimal-rstan-package.html

I’m able to install rstantools, but there’s an error in running rstan_package_skeleton(). I don’t know how close it is to being a well-formed package. Some help?

Here’s what happens when I run it:

> rstan_package_skeleton(path="rpkg")
Creating package skeleton for package: rpkg
Running usethis::create_package ...
New project 'rpkg' is nested inside an existing project '.'. This is rarely a good idea. Do you wish to create anyway?
1: Not now
2: No
3: I agree

Selection: 3
✔ Setting active project to '/Users/daniel/dev/merck-pilot/rpkg'
✔ Creating 'R/'
✔ Creating 'man/'
✔ Writing 'DESCRIPTION'
✔ Writing 'NAMESPACE'
✔ Creating 'tools/'
✔ Creating 'src/'
✔ Creating 'src/stan_files/'
✔ Creating 'src/stan_files/chunks/'
✔ Creating 'inst/'
✔ Creating 'inst/include/'
Updating R directory ...
Adding .travis.yml file ...
Updating DESCRIPTION with necessary dependencies ...
Updating NAMESPACE ...
Writing NAMESPACE
Error in getDLLRegisteredRoutines.DLLInfo(dll, addNames = FALSE) : 
  must specify DLL via a “DLLInfo” object. See getLoadedDLLs()

I’ve also verified that this happens on another Mac.

Is there a known work-around? Should I file a bug report? Is there more information I can provide?

cc: @jonah @bgoodri


  • Mac OS/X 10.14.1
  • RStan Version: 2.18.2
  • rstantools version: rstantools_1.5.1
  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
  • Output of devtools::session_info("rstan")
> devtools::session_info("rstan")
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 os       macOS  10.14.1              
 system   x86_64, darwin15.6.0        
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2018-12-04                  

─ Packages ───────────────────────────────────────────────────────────────────
 package      * version   date       lib source        
 assertthat     0.2.0     2017-04-11 [1] CRAN (R 3.5.0)
 backports      1.1.2     2017-12-13 [1] CRAN (R 3.5.0)
 base64enc      0.1-3     2015-07-28 [1] CRAN (R 3.5.0)
 BH             1.66.0-1  2018-02-13 [1] CRAN (R 3.5.0)
 callr          3.0.0     2018-08-24 [1] CRAN (R 3.5.0)
 cli            1.0.1     2018-09-25 [1] CRAN (R 3.5.0)
 colorspace     1.3-2     2016-12-14 [1] CRAN (R 3.5.0)
 crayon         1.3.4     2017-09-16 [1] CRAN (R 3.5.0)
 desc           1.2.0     2018-05-01 [1] CRAN (R 3.5.0)
 digest         0.6.18    2018-10-10 [1] CRAN (R 3.5.0)
 fansi          0.4.0     2018-10-05 [1] CRAN (R 3.5.0)
 ggplot2      * 3.1.0     2018-10-25 [1] CRAN (R 3.5.0)
 glue           1.3.0     2018-07-17 [1] CRAN (R 3.5.0)
 gridExtra      2.3       2017-09-09 [1] CRAN (R 3.5.0)
 gtable         0.2.0     2016-02-26 [1] CRAN (R 3.5.0)
 inline         0.3.15    2018-05-18 [1] CRAN (R 3.5.0)
 labeling       0.3       2014-08-23 [1] CRAN (R 3.5.0)
 lattice        0.20-35   2017-03-25 [1] CRAN (R 3.5.1)
 lazyeval       0.2.1     2017-10-29 [1] CRAN (R 3.5.0)
 loo            2.0.0     2018-04-11 [1] CRAN (R 3.5.0)
 magrittr       1.5       2014-11-22 [1] CRAN (R 3.5.0)
 MASS           7.3-50    2018-04-30 [1] CRAN (R 3.5.1)
 Matrix         1.2-14    2018-04-13 [1] CRAN (R 3.5.1)
 matrixStats    0.54.0    2018-07-23 [1] CRAN (R 3.5.0)
 mgcv           1.8-24    2018-06-23 [1] CRAN (R 3.5.1)
 munsell        0.5.0     2018-06-12 [1] CRAN (R 3.5.0)
 nlme           3.1-137   2018-04-07 [1] CRAN (R 3.5.1)
 pillar         1.3.0     2018-07-14 [1] CRAN (R 3.5.0)
 pkgbuild       1.0.2     2018-10-16 [1] CRAN (R 3.5.0)
 plyr           1.8.4     2016-06-08 [1] CRAN (R 3.5.0)
 prettyunits    1.0.2     2015-07-13 [1] CRAN (R 3.5.0)
 processx       3.2.0     2018-08-16 [1] CRAN (R 3.5.0)
 ps             1.2.1     2018-11-06 [1] CRAN (R 3.5.0)
 R6             2.3.0     2018-10-04 [1] CRAN (R 3.5.0)
 RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 3.5.0)
 Rcpp         * 1.0.0     2018-11-07 [1] CRAN (R 3.5.0)
 RcppEigen      0.3.3.5.0 2018-11-24 [1] CRAN (R 3.5.0)
 reshape2       1.4.3     2017-12-11 [1] CRAN (R 3.5.0)
 rlang          0.3.0.1   2018-10-25 [1] CRAN (R 3.5.0)
 rprojroot      1.3-2     2018-01-03 [1] CRAN (R 3.5.0)
 rstan        * 2.18.2    2018-11-07 [1] CRAN (R 3.5.0)
 scales         1.0.0     2018-08-09 [1] CRAN (R 3.5.0)
 StanHeaders  * 2.18.0    2018-10-07 [1] CRAN (R 3.5.0)
 stringi        1.2.4     2018-07-20 [1] CRAN (R 3.5.0)
 stringr        1.3.1     2018-05-10 [1] CRAN (R 3.5.0)
 tibble         1.4.2     2018-01-22 [1] CRAN (R 3.5.0)
 utf8           1.1.4     2018-05-24 [1] CRAN (R 3.5.0)
 viridisLite    0.3.0     2018-02-01 [1] CRAN (R 3.5.0)
 withr          2.1.2     2018-03-15 [1] CRAN (R 3.5.0)

[1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library

#2

Does it work if you specify the stan_files argument?


#3

No, it does not. Stops in exactly the same place.

More detail: I created a simple, valid model called intro.stan in the working directory. Then I called this:

rstan_package_skeleton("rpkg", stan_files="intro.stan")

#4

Some more detail… I dug into to the source and I’m finding that this message comes from this line:

> roxygen2::roxygenise(package.dir = DIR, clean = TRUE)
Writing NAMESPACE
Loading rpkg
Error in getDLLRegisteredRoutines.DLLInfo(dll, addNames = FALSE) : 
  must specify DLL via a “DLLInfo” object. See getLoadedDLLs()

I was able to run that outside of the rstan_package_skeleton() code and see it fail. Any suggestions?


#5

Yeah, roxygen2 changed in ways that broke a lot of people’s stuff. I would just try installing rstantools from GitHub

devtools::install_github("stan-dev/rstantools", ref = "dd1009c")

because we call roxygen2 less.