I have persistent errors while checking if is possible to install a package I made. The error I see is that I don't have a package installed from the Rstudio builder. However, I do have it installed and it can be loaded (see below)
From R packages, the advice doesn't tell you what is going on:
Checking whether package ‘XYZ’ can be installed. R CMD check runs R CMD install to make sure that it’s possible to install your package. If this fails, you should run devtools::install() or RStudio’s Build & Reload and debug any problems before continuing.
I followed the advice, it seemed to install another package, and it installed correctly. but still the devtools::check returned an ERROR.
There are some post here, about failing to pass the check. See the error message:
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘integration’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘Matrix’
The problem is that the Matrix package is up to date (I reinstalled it to make sure). But in a CI test it builds correctly.
What is done when "testing if installed package can be loaded"?
I looked into the source of tools, but I couldn't make sense of what is doing.
It is running an internal .install_packages function while testing if test_load which seems to call base::library which seems to load the namespace.
Neither from Rstudio build window and from the command line and it can't build correctly using devtools::check. But I can check after:
R CMD build package
R CMD check package_X.Y.Z.tar.gz
Which resulted in only a NOTE
Relevant info, I moved some packages from one lib to another, which may have created some errors to packages that have compiled code. However I think it was just a few (~10) packages.
> library("Matrix")
> session_info("Matrix")
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 3.5.1 (2018-07-02)
os Ubuntu 16.04.5 LTS
system i686, linux-gnu
ui RStudio
language en_US
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Madrid
date 2018-10-22
─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────
package * version date lib source
lattice 0.20-35 2017-03-25 [1] CRAN (R 3.5.0)
Matrix * 1.2-14 2018-04-09 [1] CRAN (R 3.5.1)
[1] /usr/lib/R/site-library
[2] /home/lrevilla/R/i686-pc-linux-gnu-library/3.5
[3] /usr/local/lib/R/site-library
[4] /usr/lib/R/library