Closed ntrlshrp closed 4 years ago
Thanks for noting this, could you give a more specific report of the conditions under which you observe this problem?
I'm not sure that adding install.packages
in the Rmd, as you do in #90, is the best way to fix this. If you do that, then each time the Rmd is knit those packages will be installed, which in many cases in unnecessary and wasteful.
If you are noticing this error on travis, then probably we should put the install.packages
function in the dockerfile. That's why we need a bit more information from you before we can decide what is the best fix.
As a point of etiquette, could you please wait for some discussion of your issue before proposing a pull request? We are all volunteers here, and a thoughtful discussion before writing any code will save everyone's time and ensure a productive and respectful exchange of ideas.
I can absolutely do pull requests after discussion! :) Here's a better bug report:
Expected behavior: Docker can build the default paper.Rmd
on recent versions of rocker/verse
Actual behavior: Using rocker/verse:3.5.3
, Dockerfile
fails with Quitting from lines 89-91 (paper.Rmd) Error in loadNamespace(name) : there is no package called 'here'
Steps to reproduce:
devtools::install_github("benmarwick/rrtools")
rrtools::create_compendium("rrtoolsTEST")
rrtoolsTEST
rrtools::use_dockerfile()
rocker/verse:###
to rocker/verse:3.5.3
in rrtoolsTEST/Dockerfile
line 1rrtoolsTEST/
docker build --rm -t rrtoolstest:1.0 .
(you may need to prepend sudo
)
Quitting from lines 89-91 (paper.Rmd)
Error in loadNamespace(name) : there is no package called 'here'
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
The command '/bin/sh -c . /etc/environment && sudo apt-get update && sudo apt-get install libudunits2-dev -y && R -e "devtools::install('/<REPO>', dep=TRUE)" && R -e "rmarkdown::render('/<REPO>/analysis/paper/paper.Rmd')"' returned a non-zero code: 1`
Notes:
rocker/verse:3.5.3 ---> f60a16c11f35
Potential solutions (very open to others' thoughts which likely see a better way to do this):
paper.Rmd
(e.g., devtools
, git2r
, here
) to the Imports
field of the DESCRIPTION
file for rrtoolsTEST
(currently, Imports: bookdown
)paper.Rmd
in the .Rmd
itself
install.packages
for these packages is wasteful, could try something likeif(!require(somepackage)){
install.packages("somepackage")
library(somepackage)
}
I can reproduce the issue.
@benmarwick Do we really need this Colophon section in the paper.Rmd
?
##### pagebreak
### Colophon
This report was generated on `r Sys.time()` using the following computational environment and dependencies:
``{r colophon, cache = FALSE}
# which R packages and versions?
devtools::session_info()
``
The current Git commit details are:
``{r}
# what commit is this file at?
git2r::repository(here::here())
``
Removing it solves the problem. And in my opinion it's better not to clutter the paper repo images with these heavy dependencies just for some default text. Or am I missing something?
Otherwise I vote for the first solution suggested by @ntrlshrp:
Add any packages used by default paper.Rmd (e.g., devtools, git2r, here) to the Imports field of the DESCRIPTION file for rrtoolsTEST (currently, Imports: bookdown)
This can be added here, I guess:
Picking this back up:
This thread hasn't received much action, so I wonder if others like any of the following for a PR:
Some recent versions of
rocker/verse
, e.g.,3.5.3
, may not have all packages explicitly used inpaper.Rmd
default (i.e.,devtools, git2r, here
), all of which are required to knitpaper.Rmd
. That is,Dockerfile
withrocker/verse:3.5.3
fails withQuitting from lines 89-91 (paper.Rmd) Error in loadNamespace(name) : there is no package called 'here'
.