I'm encountering an issue where remotes::install_version() does not seem to respect the lib argument or the R_LIBS_USER environment variable. Instead, it attempts to install to the list of default system libraries, which is not writable because of the way it's formatted.
This behavior is undocumented as ?remotes::install_version does not explicitly mention the lib = parameter, but rather says:
... Other arguments passed on to utils::install.packages().
Here's a minimal reproducible example:
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
dir.create(file.path("~", "dummy_r_lib"), showWarnings = FALSE)
Sys.setenv(R_LIBS_USER = "~/dummy_r_lib")
install.packages("abbreviate", lib = Sys.getenv("R_LIBS_USER"))
remotes::install_version("abbreviate", "0.1", lib = Sys.getenv("R_LIBS_USER"))
#> Downloading package from url: https://cloud.r-project.org/src/contrib/abbreviate_0.1.tar.gz
#> Warning in i.p(...): 'lib =
#> "/home/zenofl01/R/x86_64-pc-linux-gnu-library/4.5:/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library"'
#> is not writable
#> Error: Failed to install 'unknown package' from URL:
#> unable to install packages
Created on 2025-04-17 with reprex v2.1.1
Session info
sessionInfo()
#> R version 4.5.0 (2025-04-11)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.2 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
#> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
#> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Europe/Paris
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] digest_0.6.37 fastmap_1.2.0 xfun_0.52 remotes_2.5.0
#> [5] glue_1.8.0 knitr_1.50 htmltools_0.5.8.1 rmarkdown_2.29
#> [9] lifecycle_1.0.4 cli_3.6.4 reprex_2.1.1 withr_3.0.2
#> [13] compiler_4.5.0 rstudioapi_0.17.1 tools_4.5.0 evaluate_1.0.3
#> [17] yaml_2.3.10 rlang_1.1.6 fs_1.6.6
I'm encountering an issue where
remotes::install_version()does not seem to respect thelibargument or theR_LIBS_USERenvironment variable. Instead, it attempts to install to the list of default system libraries, which is not writable because of the way it's formatted.This behavior is undocumented as
?remotes::install_versiondoes not explicitly mention thelib =parameter, but rather says:Here's a minimal reproducible example:
Created on 2025-04-17 with reprex v2.1.1
Session info