Ivan - thanks for looking into this. My answers to your comments are below.
Cheers David On 12/13/2019 1:46 AM, Ivan Krylov wrote: On Thu, 12 Dec 2019 15:48:13 +0000 David Stevens <david.stev...@usu.edu><mailto:david.stev...@usu.edu> wrote: Certain R packages will not install properly on my Windows 10 computer. Certain, but not all? Which packages are you able to install on that computer? Too many to name - one is nlstools. Another is tinytex. I updated many package after bookdown wouldn't install for the same reasons. Out of a list of ~20 packages to install, ~5 failed with a similar error message. That sent me down the rabbit hole that brought me here. Warning: invalid package 'C:\Users\David' Warning: invalid package 'Stevens\AppData\Local\Temp\Rtmpk5NqrI/downloaded_packages/callr_3.4.0.tar.gz' This looks like a command line argument quoting issue. I wonder why doesn't install.packages use shQuote to quote the file name when calling system2(c("R", "CMD", "INSTALL", file)) to install a downloaded source package: https://github.com/wch/r-source/blob/e554f7f12b22868bdae51aadaeea4d56c9f87a32/src/library/utils/R/packages2.R#L833 Maybe there should be shQuote(fil) instead, especially since R does quote the file name when installing from local source tarballs: https://github.com/wch/r-source/blob/e554f7f12b22868bdae51aadaeea4d56c9f87a32/src/library/utils/R/packages2.R#L676 This happens on only a subset of packages I install or update. I have a hypothesis: perhaps this only happens for packages with no pre-built Windows binary available yet, since "win.binary" packages may be installed by unpacking a zip file, without calling a command line with potential space quoting issues: I read a thread elsewhere that said a work around is to run options(pkgType='binary') before installation and the problem went away. Does this help. https://github.com/wch/r-source/blob/e554f7f12b22868bdae51aadaeea4d56c9f87a32/src/library/utils/R/packages2.R#L491 -> https://github.com/wch/r-source/blob/e554f7f12b22868bdae51aadaeea4d56c9f87a32/src/library/utils/R/windows/install.packages.R#L263 Calling install.packages(..., verbose = TRUE) for both a succeeding and a failing package might help to verify whether this is the case. This is a relatively recent issue (i.e. I never saw it before November - I've used R for ~15 years). Just to confirm it: you had no problems on the same Windows 10 computer with the same user name and %USERPROFILE% path as before? Yes, this is the case. I do the regular Windows 10 updates and update R and RStudio as soon as I am aware there's a new version out. I haven't explicitly change %USERPROFILE%. Apparently, tempdir() used to return a 8.3 directory path on your computer, but now doesn't - but that should not happen, since R_reInitTempDir() explicitly asks for a 8.3 path: tempdir() gives tempdir() [1] "C:\\Users\\David Stevens\\AppData\\Local\\Temp\\RtmpQpqh0t" > https://github.com/wch/r-source/blob/e554f7f12b22868bdae51aadaeea4d56c9f87a32/src/main/sysutils.c#L1810 Microsoft Docs page for GetShortPathName() says: If you call GetShortPathName on a path that doesn't have any short names on-disk, the call will succeed, but will return the long-name path instead. This outcome is also possible with NTFS volumes because there's no guarantee that a short name will exist for a given long name. Some newer Windows 10 installations may have NtfsDisable8dot3NameCreation enabled, thus preventing R from getting a 8.3 path to the temp directory. I am taking the liberty of Cc-ing R-devel because this might warrant adding a shQuote() call to install.packages(). Thanks for looking into this. -- David K Stevens, PhD, PE Environmental Engineering Division Civil and Environmental Engineering Utah State University 8200 Old Main Hill Logan, UT 83200-8200 (435) 797-3229 david.stev...@usu.edu<mailto:david.stev...@usu.edu> [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.