[Rd] Rcmd_environ and R_LIBS_{USER,SITE}

Dirk Eddelbuettel edd at debian.org
Fri Oct 19 23:58:30 CEST 2012


Hi Uwe,

On 19 October 2012 at 19:25, Uwe Ligges wrote:
| Dirk,
| 
| if you ask R to
| 
| R CMD check foo_1.2-3.tar.gz
| 
| 
| and the output is
| 
| "no package called 'foo'"
| 
| then something went wrong with your setup or your package.

That is not what I said, or tried to say. My issue is that the _tests_ and
_examples_ fail.
 
| Can we have details?

Sure -- See below.  Cut and pasted from an Emacs buffer on Windoze as
evidenved by the U:\ directory at mingw id shown. Emacs has no role here, it
also fails the same way in a normal DOS prompt.


u:\R\src>R CMD check foo_0.2.2.tar.gz
R CMD check foo_0.2.2.tar.gz
* using log directory 'u:/R/src/foo.Rcheck'
* using R version 2.15.1 (2012-06-22)
* using platform: x86_64-pc-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'foo/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'foo' version '0.2.2'
* 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 whether package 'foo' can be installed ... [34s] OK
* checking installed package size ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level 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
* loading checks for arch 'i386'
** 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
* loading checks for arch 'x64'
** 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 for unstated 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 line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking for portable compilation flags in Makevars ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... OK
* checking examples ...
** running examples for arch 'i386' ... ERROR
Running examples in 'foo-Ex.R' failed
The error occurred in:


R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-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.

> pkgname <- "foo"
> source(file.path(R.home("share"), "R", "examples-header.R"))
> options(warn = 1)
> options(pager = "console")
> library('foo')
Error in library("foo") : there is no package called 'foo'
Execution halted
** running examples for arch 'x64' ... ERROR
Running examples in 'foo-Ex.R' failed
The error occurred in:


R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-mingw32/x64 (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.

> pkgname <- "foo"
> source(file.path(R.home("share"), "R", "examples-header.R"))
> options(warn = 1)
> options(pager = "console")
> library('foo')
Error in library("foo") : there is no package called 'foo'
Execution halted

u:\R\src>

Needless to say the package __does__ of course exist, is installed and
loadable:


u:\R\src>R --no-save
R --no-save

R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-mingw32/x64 (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.

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.

R> library(foo)
library(foo)
Loading required package: Rcpp
Loading required package: xts
Loading required package: zoo

Attaching package: 'zoo'

The following object(s) are masked from 'package:base':

    as.Date, as.Date.numeric

R> 


[ foo is a placeholder here, the package has a different name which plays no
role in the misbehaviour demonstrated above. ]

Thanks for looking into this.  

Dirk


| Best,
| Uwe
| 
| 
| 
| 
| On 19.10.2012 15:21, Dirk Eddelbuettel wrote:
| >
| > On 19 October 2012 at 12:39, Gavin Simpson wrote:
| > | On Thu, 2012-10-18 at 10:18 -0500, Dirk Eddelbuettel wrote:
| > | > Kasper,
| > | >
| > | > On 18 October 2012 at 10:41, Kasper Daniel Hansen wrote:
| > | > | I set my user libraries in .Rprofile for this very reason.  I agree it
| > | > | is weird that .Renviron is not always read etc.
| > | >
| > | > Sorry, no cigar either -- this equivalent to using files in $R_HOME/etc/ and
| > | > is also ignored by R CMD check, which still fails in my setup as it doesn't
| > | > find the package -- whereas any normal R session does.
| > | >
| > | > Dirk
| > |
| > | I have R_LIBS set in my Bash profile (~/.bashrc) for IIRC this very
| > | reason. Can you do the same on Windows?
| >
| > Thanks for the suggestion, Gavin,  But well, let me count the ways ....
| >
| > i)   As a general principle, I prefer to minimize env variables. So on Linux,
| >       I prefer (and use) ~/.Rprofile and/or ~/.Renviron, or even the site-wide
| >       ones
| >
| > ii)  Similarly, I asked for site-wide config as that can be scripted.
| >       Your solution, if it worked, would not (as easily) allow that.
| >
| > iii) The question was specific about the intentional castration of R CMD ...
| >       I actually get the .libPaths() adjusted on Windows too via the method
| >       mentioned in i)
| >
| > iv)  When I do what you helpfully suggest, .libPaths() in R shows the entry
| >       twice yet the braindead R CMD check .... __still fails the same way__ not
| >       being able to load the very package tested from the location that is __not
| >       below__ the $R_HOME/library/ path.
| >
| > This really is silly beyond words, but seemingly all by design and intentional.
| >
| > Dirk
| >
| >
| >
| >
| > |
| > | G
| > |
| > | >
| > | >
| > | > |
| > | > | Kasper
| > | > |
| > | > | On Thu, Oct 18, 2012 at 10:12 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
| > | > | >
| > | > | > Keith,
| > | > | >
| > | > | > On 18 October 2012 at 09:14, Keith Jewell wrote:
| > | > | > | No reply in a number of hours, so here is a suggestion from ignorance :-}
| > | > | > |
| > | > | > | ?Startup refers to a number of other "site and user files to process for
| > | > | >
| > | > | > Thanks, and I know, and use those on Linux (and on 'doze when I use it).  My
| > | > | > question was specifically about 'R CMD foo' which skips some of these by
| > | > | > choice, and which Rcmd_environ appears to overcome, albeit imcompletely. I
| > | > | > still have an issue on Windows where I cannot split my package installations
| > | > | > between those that come and go with R installations, and the others.
| > | > | >
| > | > | > But it is truly bizarre that I can do (on Windows)
| > | > | >
| > | > | >   R CMD INSTALL foo_1.2-3.tar.gz
| > | > | >
| > | > | > and a moment later
| > | > | >
| > | > | >   R CMD check foo_1.2-3.tar.gz
| > | > | >
| > | > | > fails in its tests and examples with "no package called 'foo'"
| > | > | >
| > | > | > Doing 'R CMD check --no-examples --no-tests foo_1.2-3.tar.gz' works, but is
| > | > | > less helpful as we're running the check to run those very tests...
| > | > | >
| > | > | > Dirk
| > | > | >
| > | > | >
| > | > | > | setting environment variables" but not to Rcmd_environ. The contents of
| > | > | > | $R_HOME/etc/Rcmd_environ seem to reflect (some of) the contents of
| > | > | > | (some) other files.
| > | > | > |
| > | > | > | I have similar lines (defining library paths) in
| > | > | > |      $R_HOME/etc/Renviron.site
| > | > | > |
| > | > | > | Is it correct to directly edit Rcmd_environ or should it be modified
| > | > | > | only via other files? (A genuine question).
| > | > | > |
| > | > | > | On 17/10/2012 15:59, Dirk Eddelbuettel wrote:
| > | > | > | >
| > | > | > | > Is there a fundamental reason why I cannot set either one of
| > | > | > | >
| > | > | > | >    ## add local library path -- doesn't work either
| > | > | > | >    R_LIBS_USER="c:/opt/R-library"
| > | > | > | >    R_LIBS_SITE="c:/opt/R-library"
| > | > | > | >
| > | > | > | > in $R_HOME/etc/Rcmd_environ even though I can seemingly set other things here?
| > | > | > | >
| > | > | > | > It breaks "R CMD check" for me as I prefer NOT to install packages in a
| > | > | > | > versioned path.
| > | > | > | >
| > | > | > | > FWIW, defaulting to a versioned path is (to this no-longer-bemused user) as
| > | > | > | > much a permenent R bug (on Windoze) as the default installation into a path
| > | > | > | > with spaces.
| > | > | > | >
| > | > | > | > Dirk
| > | > | > | >
| > | > | > |
| > | > | > | ______________________________________________
| > | > | > | R-devel at r-project.org mailing list
| > | > | > | https://stat.ethz.ch/mailman/listinfo/r-devel
| > | > | >
| > | > | > --
| > | > | > Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
| > | > | >
| > | > | > ______________________________________________
| > | > | > R-devel at r-project.org mailing list
| > | > | > https://stat.ethz.ch/mailman/listinfo/r-devel
| > | >
| > |
| > | --
| > | %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
| > |  Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
| > |  ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
| > |  Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
| > |  Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
| > |  UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
| > | %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
| > |
| > |
| >

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



More information about the R-devel mailing list