I have a local library which depends on the expm library. The expm library is loaded into my personal space and I have the environment variable R_LIBS_USER set appropriately. The command "library(expm)" works just fine from the command line, and in fact the package works if I do the source() and dyn.load() commands by hand. The following sequence works: tmt% R CMD build --no-build-vignettes hmm tmt% R CMD INSTALL hmm*gz tmt% R > library(hmm) > run some commands from the hmm library But "R CMD check hmm.gz" fails with ERROR: dependency ?expm? is not available for package ?hmm? * removing ?/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm? The R CMD build command fails similarly if I let it try to build the vignettes. What's up? Terry T > sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS release 6.8 (Final)
On Wed, 2017-02-08 at 15:51 -0600, Therneau, Terry M., Ph.D. wrote:> I have a local library which depends on the expm library.??The expm library is loaded into? > my personal space and I have the environment variable R_LIBS_USER set appropriately.??The? > command "library(expm)" works just fine from the command line, and in fact the package? > works if I do the source() and dyn.load() commands by hand. > > The following sequence works: > > tmt% R CMD build --no-build-vignettes hmm > tmt% R CMD INSTALL hmm*gz > tmt% R > ?> library(hmm) > ?>??run some commands from the hmm library > > But "R CMD check hmm.gz" fails with > ???ERROR: dependency ?expm? is not available for package ?hmm? > * removing > ?/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm? > > The R CMD build command fails similarly if I let it try to build the > vignettes. > > What's up?If you are setting the environment variable R_LIBS_USER in R_HOME/site/Renviron.site or in .Renviron then this file will not be read when you run R CMD check or R CMD build, as R is then run with -- vanilla which implies --no-environ.? You also need to set it in these files: ~/.R/build.Renviron ~/.R/check.Renviron See R-exts section 1.3 and ?Startup. Martyn> Terry T > > > ?> sessionInfo() > R version 3.3.1 (2016-06-21) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: CentOS release 6.8 (Final) > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Martin, I am aware of --vanilla; I use it myself for some testing. In this case R_LIBS_USER was set externally (part of my login) and does not involve any of the R scripts. That means it is inherited by any subprocess. For example: tmt1495% R --vanilla --no-environ R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit)> system("printenv | grep R_LIBS")R_LIBS_SITER_LIBS_USER=/people/biostat2/therneau/Rlib So, per the manual R CMD check inherits the path. The question is why does it ignore it? Terry T. On 02/09/2017 02:54 AM, Martyn Plummer wrote:> On Wed, 2017-02-08 at 15:51 -0600, Therneau, Terry M., Ph.D. wrote: >> I have a local library which depends on the expm library. The expm library is loaded into >> my personal space and I have the environment variable R_LIBS_USER set appropriately. The >> command "library(expm)" works just fine from the command line, and in fact the package >> works if I do the source() and dyn.load() commands by hand. >> >> The following sequence works: >> >> tmt% R CMD build --no-build-vignettes hmm >> tmt% R CMD INSTALL hmm*gz >> tmt% R >> > library(hmm) >> > run some commands from the hmm library >> >> But "R CMD check hmm.gz" fails with >> ERROR: dependency ?expm? is not available for package ?hmm? >> * removing >> ?/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm? >> >> The R CMD build command fails similarly if I let it try to build the >> vignettes. >> >> What's up? > > If you are setting the environment variable R_LIBS_USER in > R_HOME/site/Renviron.site or in .Renviron then this file will not be > read when you run R CMD check or R CMD build, as R is then run with -- > vanilla which implies --no-environ. > > You also need to set it in these files: > > ~/.R/build.Renviron > ~/.R/check.Renviron > > See R-exts section 1.3 and ?Startup. > > Martyn > >> Terry T >> >> >> > sessionInfo() >> R version 3.3.1 (2016-06-21) >> Platform: x86_64-pc-linux-gnu (64-bit) >> Running under: CentOS release 6.8 (Final) >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel