White-space in file path causes error when installing/updating packages from source

(this issue is also discussed here)

My windows username is my real name with a whitespace between. From R 3.6.2 (I think) onwards, this has been an issue with package installations and updates from source. Binary versions do not have any issues.

example:

Warning: invalid package 'C:\Users\Angelos'
Warning: invalid package 'Amyntas\AppData\Loca\Temp\RtmpQBRREj/downloaded_packages/phytools_0.7-20.tar.gz'
Error: ERROR: no packages specified Warning in install.packages :
installation of package ‘phytools’ had non-zero exit status

I tried solving that by specifying the folder a new package will be saved and the library it will be stored to so that they are outside the problematic path: install.packages("C:/pckg/package.tar.gz", repos = NULL, type = "source", lib="C:/Program Files/R/R-3.6.3/library").
this is the result of that:

** byte-compile and prepare package for lazy loading
Fatal error: cannot open file 'C:\Users\Angelos': No such file or directory

which I think suggests that the lazy loading procedure uses something out of the user folder.
R does not otherwise seem to mind the whitespace being part of the working directory path. Or in fact the library path, since I have my default package library in my user folder. I do not understand how this is possible. Are there any solutions to this other than actually changing the username?

sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_2.2.2 usethis_1.5.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 rstudioapi_0.11 magrittr_1.5 pkgload_1.0.2 R6_2.4.1 rlang_0.4.5
[7] fansi_0.4.1 tools_3.6.3 pkgbuild_1.0.6 sessioninfo_1.1.1 cli_2.0.2 withr_2.1.2
[13] ellipsis_0.3.0 remotes_2.1.1 assertthat_0.2.1 digest_0.6.25 rprojroot_1.3-2 crayon_1.3.4
[19] processx_3.4.2 callr_3.4.2 fs_1.3.2 ps_1.3.2 testthat_2.3.2 memoise_1.1.0
[25] glue_1.3.2 compiler_3.6.3 desc_1.2.0 backports_1.1.5 prettyunits_1.1.1

This was an issue with previous versions too

A walk around is to use the system level library folder, or any other folder not located under your user folder. This usually works but I can't tell why it fails when you try to install from a local file.

If I was you, I would try migrating my entire package library to the system level library and setting the default library path on my Rprofile.site file.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.