rstudio/vetiver-r

`library(vetiver)` Overwrites `.libPaths()`.

Closed this issue · 2 comments

When used in conjunction with renv@0.15.5, the path to the System Library is overwritten when library(vetiver) is loaded. The System Library path is overwritten with the path to the renv sandbox.

If this is no longer an issue with more recent versions of renv, please let me know and I can test that. Our team has used renv@0.15.5 because the renv@1.0.0 launch was not as stable as we would have liked upon its release. We have not revisited the later versions since its launch.
 

> library(renv)

Attaching package: ‘renv’

The following objects are masked from ‘package:stats’:

    embed, update

The following objects are masked from ‘package:utils’:

    history, upgrade

The following objects are masked from ‘package:base’:

    autoload, load, remove
> renv::status()`
* The project is already synchronized with the lockfile.
> .libPaths()
[1] "/home/user_account/A_R_Vetiver_Project/renv/library/R-4.1/x86_64-pc-linux-gnu"
[2] "/opt/R/4.1.2/lib/R/library"                                                
> library(tidyverse)
── Attaching core tidyverse packages ───────────────────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ─────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
✖ purrr::modify() masks renv::modify()
ℹ Use the conflicted package to force all conflicts to become errors
> library(tidymodels)
── Attaching packages ─────────────────────────────────────────────────── tidymodels 1.2.0 ──
✔ broom        1.0.6      ✔ rsample      1.2.1 
✔ dials        1.2.1      ✔ tune         1.2.1 
✔ infer        1.0.7      ✔ workflows    1.1.4 
✔ modeldata    1.3.0      ✔ workflowsets 1.1.0 
✔ parsnip      1.2.1      ✔ yardstick    1.3.1 
✔ recipes      1.0.10     
── Conflicts ────────────────────────────────────────────────────── tidymodels_conflicts() ──
✖ scales::discard() masks purrr::discard()
✖ dplyr::filter()   masks stats::filter()
✖ recipes::fixed()  masks stringr::fixed()
✖ dplyr::lag()      masks stats::lag()
✖ purrr::modify()   masks renv::modify()
✖ yardstick::spec() masks readr::spec()
✖ recipes::step()   masks stats::step()
✖ recipes::update() masks renv::update(), stats::update()
• Use tidymodels_prefer() to resolve common conflicts.
> .libPaths()
[1] "/home/user_account/A_R_Vetiver_Project/renv/library/R-4.1/x86_64-pc-linux-gnu"
[2] "/opt/R/4.1.2/lib/R/library"                                         
> library(vetiver)

Attaching package: ‘vetiver’

The following object is masked from ‘package:tune’:

    load_pkgs
[1] "/home/user_account/A_R_Vetiver_Project/renv/library/R-4.1/x86_64-pc-linux-gnu"
[2] "/home/user_account/.cache/R/renv/sandbox/R-4.1/x86_64-pc-linux-gnu/06572222" 

I am not able to reproduce any changes to .libPaths() using the current CRAN version of renv (1.0.7):

library(renv)
#> 
#> Attaching package: 'renv'
#> The following objects are masked from 'package:stats':
#> 
#>     embed, update
#> The following objects are masked from 'package:utils':
#> 
#>     history, upgrade
#> The following objects are masked from 'package:base':
#> 
#>     autoload, load, remove, use
.libPaths()
#> [1] "/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library"
library(tidyverse)
.libPaths()
#> [1] "/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library"
library(vetiver)
.libPaths()
#> [1] "/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library"

Created on 2024-07-31 with reprex v2.1.1

Session info

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.0 (2024-04-24)
#>  os       macOS Sonoma 14.5
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       America/Denver
#>  date     2024-07-31
#>  pandoc   3.2.1 @ /opt/homebrew/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  cli           3.6.3      2024-06-21 [1] CRAN (R 4.4.0)
#>  colorspace    2.1-1      2024-07-26 [1] CRAN (R 4.4.0)
#>  digest        0.6.36     2024-06-23 [1] CRAN (R 4.4.0)
#>  dplyr       * 1.1.4      2023-11-17 [1] CRAN (R 4.4.0)
#>  evaluate      0.24.0     2024-06-10 [1] CRAN (R 4.4.0)
#>  fansi         1.0.6      2023-12-08 [1] CRAN (R 4.4.0)
#>  fastmap       1.2.0      2024-05-15 [1] CRAN (R 4.4.0)
#>  forcats     * 1.0.0      2023-01-29 [1] CRAN (R 4.4.0)
#>  fs            1.6.4      2024-04-25 [1] CRAN (R 4.4.0)
#>  generics      0.1.3      2022-07-05 [1] CRAN (R 4.4.0)
#>  ggplot2     * 3.5.1      2024-04-23 [1] CRAN (R 4.4.0)
#>  glue          1.7.0      2024-01-09 [1] CRAN (R 4.4.0)
#>  gtable        0.3.5      2024-04-22 [1] CRAN (R 4.4.0)
#>  hms           1.1.3      2023-03-21 [1] CRAN (R 4.4.0)
#>  htmltools     0.5.8.1    2024-04-04 [1] CRAN (R 4.4.0)
#>  knitr         1.48       2024-07-07 [1] CRAN (R 4.4.0)
#>  lifecycle     1.0.4      2023-11-07 [1] CRAN (R 4.4.0)
#>  lubridate   * 1.9.3      2023-09-27 [1] CRAN (R 4.4.0)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.4.0)
#>  munsell       0.5.1      2024-04-01 [1] CRAN (R 4.4.0)
#>  pillar        1.9.0      2023-03-22 [1] CRAN (R 4.4.0)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.4.0)
#>  purrr       * 1.0.2      2023-08-10 [1] CRAN (R 4.4.0)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.4.0)
#>  readr       * 2.1.5      2024-01-10 [1] CRAN (R 4.4.0)
#>  renv        * 1.0.7      2024-04-11 [1] CRAN (R 4.4.0)
#>  reprex        2.1.1      2024-07-06 [1] CRAN (R 4.4.0)
#>  rlang         1.1.4      2024-06-04 [1] CRAN (R 4.4.0)
#>  rmarkdown     2.27       2024-05-17 [1] CRAN (R 4.4.0)
#>  scales        1.3.0      2023-11-28 [1] CRAN (R 4.4.0)
#>  sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.4.0)
#>  stringi       1.8.4      2024-05-06 [1] CRAN (R 4.4.0)
#>  stringr     * 1.5.1      2023-11-14 [1] CRAN (R 4.4.0)
#>  tibble      * 3.2.1      2023-03-20 [1] CRAN (R 4.4.0)
#>  tidyr       * 1.3.1      2024-01-24 [1] CRAN (R 4.4.0)
#>  tidyselect    1.2.1      2024-03-11 [1] CRAN (R 4.4.0)
#>  tidyverse   * 2.0.0      2023-02-22 [1] CRAN (R 4.4.0)
#>  timechange    0.3.0      2024-01-18 [1] CRAN (R 4.4.0)
#>  tzdb          0.4.0      2023-05-12 [1] CRAN (R 4.4.0)
#>  utf8          1.2.4      2023-10-22 [1] CRAN (R 4.4.0)
#>  vctrs         0.6.5      2023-12-01 [1] CRAN (R 4.4.0)
#>  vetiver     * 0.2.5.9000 2024-07-19 [1] Github (rstudio/vetiver-r@ff0509c)
#>  withr         3.0.0      2024-01-16 [1] CRAN (R 4.4.0)
#>  xfun          0.46       2024-07-18 [1] CRAN (R 4.4.0)
#>  yaml          2.3.10     2024-07-26 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Let me know if you have any followup questions!

Let us know if you experience further problems!