3

I'm testing an R-package (called 'TRIMmaps') and ran devtools::check(). The check "checking whether package ‘TRIMmaps’ can be installed" failed. In the log-files I found the following information:

in 00check.log...

* using log directory ‘/tmp/RtmpsnrErp/TRIMmaps.Rcheck’
* using R version 3.4.4 (2018-03-15)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using options ‘--no-manual --as-cran’
* checking for file ‘TRIMmaps/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘TRIMmaps’ version ‘1.14-0’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘TRIMmaps’ can be installed ... ERROR
Installation failed.
See ‘/tmp/RtmpsnrErp/TRIMmaps.Rcheck/00install.out’ for details.
* DONE

...and in 00install.out:

* installing *source* package ‘TRIMmaps’ ...
** R
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘lattice’
ERROR: lazy loading failed for package ‘TRIMmaps’
* removing ‘/tmp/RtmpsnrErp/TRIMmaps.Rcheck/TRIMmaps’

Following the advice of Hadley Wickham in his book 'R packages' I ran devtools::install() to see what's going wrong during the installation, but it runs without any problem and the package gets installed! Why can it be installed with devtools::install() but not with devtools::check()?

Moreover I am puzzled by the message about the missing package lattice in 00install.out: lattice is installed, it is installed in my default library (the first displayed by .libPaths()), it is listed in the DESCRIPTION file under Imports and it is listed in the NAMESPACE file.

Anyone a hint what's going on here? Thanks in advance!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
user7417
  • 1,531
  • 3
  • 15
  • 20
  • Do you have multiple libraries? What library is the default and which library is `lattice` installed in? `.libPaths()` might be useful. – Gregor Thomas Nov 27 '18 at 17:27
  • @Gregor: Yes, I have multiple libraries. How can this cause problems? – user7417 Nov 28 '18 at 10:37
  • @Gregor: Actually `lattice` is installed in my default library (the first displayed by `.libPaths()`). – user7417 Nov 29 '18 at 08:38
  • Maybe edit that info into your question. It's relevant, and editing your question (unlike commenting) will bump it to the top of the "active" queue. – Gregor Thomas Nov 29 '18 at 13:57
  • FWIW, I had a similar issue. When I fixed my warnings this issue went away for me. Specifically, I had `W checking dependencies in R code ... '::' or ':::' imports not declared from: ‘quantmod’ ‘xts’ ‘zoo’` warnings. Not sure why, but getting rid of warnings worked for me. Maybe try that first? – jmuhlenkamp Jan 03 '19 at 21:47
  • @jmuhlenkamp: What do you mean with 'I fixed my warnings'? I do not encounter any warnings by running devtools::check() but just an error ... and that one is fatal. – user7417 Jan 07 '19 at 16:49
  • @user7417 mine had warnings. Must not apply for your case. I'm not sure what the root cause was though, sorry. – jmuhlenkamp Jan 08 '19 at 16:40
  • 1
    I found the source of my problem: the missing packages(s) were installed in my personal library, the first one listed by .libPaths(). devtools::install() seems to have used this library and thus installed my package without problems. devtools::check(), however, needed all the packages to be installed in /usr/local/lib/R/site-library which is the second one shown by .libPaths(). I installed all packages (lattice and some others) in this library and afterwards devtools::check() worked well. – user7417 Jan 22 '19 at 08:59
  • Is it a packrat project? – woodvi Mar 15 '19 at 18:13
  • No, it's not, but perhaps I will use packrat in the future. – user7417 Mar 18 '19 at 09:25

0 Answers0