[R] package building problem Centos 7 & R 3.4.1

Paul Johnson pauljohn32 at gmail.com
Fri Aug 11 23:51:12 CEST 2017


Dear everybody:

Packages that DO pass the package check on my Ubuntu 17.04 laptop with
R 3.4.1 and Mac OSX do not build on Centos 7 with R 3.4.1. I'm pretty
sure I have an environment defect, but cannot find it.

I find posts from various people about this problem since 2012.  But
I've checked the likely suspects. Among all the runs I pasted in
below, the most informative error message I found is the very last
one, which ends like this:

It looks like this package has a loading problem when not on .libPaths:
see the messages for details.

The messages don't really help me understand (all pasted in full
detail below), but I hope you'll say "aha", there's that environment
thing again.

I notice that package check proceeds differently without "--as-cran".
In some cases, package check passes. Other times, it fails
differently.

Here are some details, I hope you have guesses about where to check for trouble.

I suspected I had an error in my packages, so I picked some at random
from the CRAN list, things which depend on openxlsx. It turns out they
don't survive check either. Hopefully this makes it easy for you to
replicate (copy/paste :) )

$ wget http://rweb.quant.ku.edu/cran/src/contrib/reproducer_0.1.9.tar.gz
$ R CMD check --as-cran reproducer_0.1.9.tar.gz
* using log directory ‘/tmp/pj/reproducer.Rcheck’
* using R version 3.4.1 (2017-06-30)
* using platform: x86_64-redhat-linux-gnu (64-bit)
* using session charset: UTF-8
* using option ‘--as-cran’
* checking for file ‘reproducer/DESCRIPTION’ ... OK
* this is package ‘reproducer’ version ‘0.1.9’
* checking CRAN incoming feasibility ... WARNING
Maintainer: ‘Lech Madeyski <lech.madeyski at gmail.com>’

Insufficient package version (submitted: 0.1.9, existing: 0.1.9)
* 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 ‘reproducer’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking use of S3 registration ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking examples ... ERROR
Running examples in ‘reproducer-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: boxplotAndDensityCurveOnHistogram
> ### Title: boxplotAndDensityCurveOnHistogram
> ### Aliases: boxplotAndDensityCurveOnHistogram
>
> ### ** Examples
>
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’
Execution halted
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘testthat.R’
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  Error: package or namespace load failed for 'testthat' in
loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]):
   there is no package called 'R6'
  Execution halted
* checking PDF version of manual ... OK
* DONE

Status: 2 ERRORs, 1 WARNING
See
  ‘/tmp/pj/reproducer.Rcheck/00check.log’
for details.

Contents of 00check.log are same:

The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: boxplotAndDensityCurveOnHistogram
> ### Title: boxplotAndDensityCurveOnHistogram
> ### Aliases: boxplotAndDensityCurveOnHistogram
>
> ### ** Examples
>
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’
Execution halted
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... ERROR
  Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  Error: package or namespace load failed for 'testthat' in
loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]):
   there is no package called 'R6'
  Execution halted
* checking PDF version of manual ... OK
* DONE
Status: 2 ERRORs, 1 WARNING

It says I'm missing packages, but not so! Observe a session:

[pauljohn at crmda-026L pj]$ R

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(R6)
> library(testthat)
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] testthat_1.0.2 R6_2.2.2

loaded via a namespace (and not attached):
[1] compiler_3.4.1 magrittr_1.5   crayon_1.3.2
>


Interestingly, if I run the check without "--as-cran", then there is
no error and the check succeeds.


Here's another package I chose at random.  This one has exactly the
same failure symptom that my packages do.

$ wget http://rweb.quant.ku.edu/cran/src/contrib/tablaxlsx_1.2.2.tar.gz
$ R CMD check --as-cran tablaxlsx_1.2.2.tar.gz
* using log directory ‘/tmp/pj/tablaxlsx.Rcheck’
* using R version 3.4.1 (2017-06-30)
* using platform: x86_64-redhat-linux-gnu (64-bit)
* using session charset: UTF-8
* using option ‘--as-cran’
* checking for file ‘tablaxlsx/DESCRIPTION’ ... OK
* this is package ‘tablaxlsx’ version ‘1.2.2’
* package encoding: latin1
* checking CRAN incoming feasibility ... WARNING
Maintainer: ‘Jesus Maria Rodriguez Rodriguez <jesusmro at ono.com>’

Insufficient package version (submitted: 1.2.2, existing: 1.2.2)

The Date field is over a month old.

This build time stamp is over a month old.
* 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 ‘tablaxlsx’ can be installed ... ERROR
Installation failed.
See ‘/tmp/pj/tablaxlsx.Rcheck/00install.out’ for details.
* DONE

Status: 1 ERROR, 1 WARNING
See
  ‘/tmp/pj/tablaxlsx.Rcheck/00check.log’
for details.

$ cat /tmp/pj/tablaxlsx.Rcheck/00install.out
* installing *source* package ‘tablaxlsx’ ...
** package ‘tablaxlsx’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing 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 ‘openxlsx’ in
loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]):
 there is no package called ‘Rcpp’
Error : package ‘openxlsx’ could not be loaded
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/tmp/pj/tablaxlsx.Rcheck/tablaxlsx’


But I do have Rcpp and openxlsx, could show you the session, as we did
with testthat and R6 before.

Moreover, observe I can install the package and it does load:

$ R CMD INSTALL tablaxlsx_1.2.2.tar.gz
* installing to library ‘/home/pauljohn/R/x86_64-redhat-linux-gnu-library/3.4’
* installing *source* package ‘tablaxlsx’ ...
** package ‘tablaxlsx’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
  converting help for package ‘tablaxlsx’
    finding HTML links ... done
    bordear                                 html
    finding level-2 HTML links ... done

    escribirTabla                           html
    estilosDGE                              html
    estilosDGEPYE                           html
    reducir                                 html
    tablaxlsx.estilos.set                   html
    trim                                    html
    verXL                                   html
** building package indices
** testing if installed package can be loaded
* DONE (tablaxlsx)

And, more importantly, the installed package will load:

$ R

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(tablaxlsx)
Loading required package: openxlsx
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] tablaxlsx_1.2.2 openxlsx_4.0.17

loaded via a namespace (and not attached):
[1] compiler_3.4.1 Rcpp_0.12.12



Building this one without "--as-cran" results in a
different/interesting error, it is more informative, but I don't
understand it.

$ R CMD check  tablaxlsx_1.2.2.tar.gz
* using log directory ‘/tmp/pj/tablaxlsx.Rcheck’
* using R version 3.4.1 (2017-06-30)
* using platform: x86_64-redhat-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘tablaxlsx/DESCRIPTION’ ... OK
* this is package ‘tablaxlsx’ version ‘1.2.2’
* package encoding: latin1
* 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 ‘tablaxlsx’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... WARNING
Loading required package: openxlsx
Error: package or namespace load failed for ‘openxlsx’ in
loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]):
 there is no package called ‘Rcpp’
Error: package ‘openxlsx’ could not be loaded
Execution halted

It looks like this package has a loading problem when not on .libPaths:
see the messages for details.
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking examples ... OK
* checking PDF version of manual ... OK
* DONE


What does it mean? It is intriguing that we don't have this problem in
Ubuntu or Macintosh.

What other info you need? Inside R:

> .libPaths()
[1] "/home/pauljohn/R/x86_64-redhat-linux-gnu-library/3.4"
[2] "/usr/lib64/R/library"
[3] "/usr/share/R/library"

The packages in question are all in "/usr/share/R/library".

The system-wide R_LIBS_SITE has that directory, Local Variables of
/usr/lib64/R/etc/Renviron:

R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib64/R/library:/usr/share/R/library'}

I have no folder named ~/.R

Thanks in advance, friends.

pj

-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.



More information about the R-help mailing list