[Rd] utils::install.packages with quiet=TRUE fails for source packages on Windows
Andreas Kersting
r-devel at akersting.de
Fri Jan 26 08:56:22 CET 2018
Hi,
Installing a source package on Windows using utils::install.packages()
with quiet=TRUE fails, while it works with the default quiet = FALSE.
The problem seems to be caused by the fact that when quiet = TRUE,
stdout and stderr are set to FALSE when calling "R CMD INSTALL" with
base::system2() here:
https://github.com/wch/r-source/blob/tags/R-3-4-3/src/library/utils/R/packages2.R#L660-L661.
> trace(base::system2, quote(print(ls.str())))
Tracing function "system2" in package "base"
[1] "system2"
> utils::install.packages("partDF_1.0.0.9001.tar.gz", repos = NULL, lib
= tempdir(), quiet = TRUE)
Tracing system2(cmd0, args, env = env, stdout = output, stderr = output)
on entry
args : chr [1:5] "CMD" "INSTALL" "-l"
"\"C:\\Users\\askers\\AppData\\Local\\Temp\\RtmpoRb97l\"" ...
command : chr "C:/PROGRA~1/R/R-34~1.3/bin/x64/R"
env : chr(0)
input : NULL
invisible : logi TRUE
minimized : logi FALSE
stderr : logi FALSE
stdin : chr ""
stdout : logi FALSE
wait : logi TRUE
Warning messages:
1: running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l
"C:\Users\askers\AppData\Local\Temp\RtmpoRb97l"
"partDF_1.0.0.9001.tar.gz"' had status 1
2: In utils::install.packages("partDF_1.0.0.9001.tar.gz", repos = NULL, :
installation of package 'partDF_1.0.0.9001.tar.gz' had non-zero exit
status
> utils::install.packages("partDF_1.0.0.9001.tar.gz", repos = NULL, lib
= tempdir(), quiet = FALSE)
Tracing system2(cmd0, args, env = env, stdout = output, stderr = output)
on entry
args : chr [1:5] "CMD" "INSTALL" "-l"
"\"C:\\Users\\askers\\AppData\\Local\\Temp\\RtmpoRb97l\"" ...
command : chr "C:/PROGRA~1/R/R-34~1.3/bin/x64/R"
env : chr(0)
input : NULL
invisible : logi TRUE
minimized : logi FALSE
stderr : chr ""
stdin : chr ""
stdout : chr ""
wait : logi TRUE
* installing *source* package 'partDF' ...
** libs
c:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-34~1.3/include" -DNDEBUG
-O2 -Wall -std=gnu99 -mtune=generic -c partDF.c -o partDF.o
c:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o partDF.dll
tmp.def partDF.o -LC:/PROGRA~1/R/R-34~1.3/bin/x64 -lR
installing to C:/Users/askers/AppData/Local/Temp/RtmpoRb97l/partDF/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'partDF'
finding HTML links ... done
anti_glob html
partDF html
read_partDF html
write_partDF html
** building package indices
** testing if installed package can be loaded
* DONE (partDF)
In R CMD INSTALL
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3 yaml_2.1.16
This problem is also there when installing source packages from CRAN:
> utils::install.packages("mvtnorm", lib = tempdir(), quiet = TRUE)
There is a binary version available but the source version is later:
binary source needs_compilation
mvtnorm 1.0-6 1.0-7 TRUE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package 'mvtnorm'
Tracing system2(cmd0, args, env = env, stdout = outfile, stderr =
outfile) on entry
args : Named chr [1:5] "CMD" "INSTALL" "-l"
"\"C:\\Users\\askers\\AppData\\Local\\Temp\\RtmpoRb97l\"" ...
command : chr "C:/PROGRA~1/R/R-34~1.3/bin/x64/R"
env : chr(0)
input : NULL
invisible : logi TRUE
minimized : logi FALSE
stderr : logi FALSE
stdin : chr ""
stdout : logi FALSE
wait : logi TRUE
Warning messages:
1: running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l
"C:\Users\askers\AppData\Local\Temp\RtmpoRb97l"
C:\Users\askers\AppData\Local\Temp\RtmpoRb97l/downloaded_packages/mvtnorm_1.0-7.tar.gz'
had status 1
2: In utils::install.packages("mvtnorm", lib = tempdir(), quiet = TRUE) :
installation of package 'mvtnorm' had non-zero exit status
I do not encounter this problem on my Linux machine.
Andreas
More information about the R-devel
mailing list