renv

Using renv but still system library active


I'm just new to renv and tried to find something similar to Pythons virtualenv. So renv seems to offer what I need. I also tried packrat, but renv can load the library when one is not in that project folder.

Project '/gpfs0/home/user/venv/modelling' loaded. [renv 0.15.5]
>.libPaths()
[1] "/gpfs0/home/user/venv/modelling/renv/library/R-4.0/x86_64-pc-linux-gnu"              
[2] "/gpfs0/global/software/easybuild-broadwell/software/R/4.0.4-foss-2020b-2/lib64/R/library"

after loading rasterVis

> sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /gpfs0/global/software/easybuild-broadwell/software/OpenBLAS/0.3.12-GCC-10.2.0/lib/libopenblas_haswellp-r0.3.12.so

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=de_DE.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] rasterVis_0.51.5 lattice_0.20-41 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6          codetools_0.2-18    png_0.1-7          
 [4] viridisLite_0.3.0   zoo_1.8-9           grid_4.0.4         
 [7] renv_0.15.5         raster_3.6-14       hexbin_1.28.2      
[10] sp_1.6-0            latticeExtra_0.6-29 RColorBrewer_1.1-3 
[13] tools_4.0.4         jpeg_0.1-8.1        parallel_4.0.4     
[16] compiler_4.0.4      terra_1.7-3        

> renv::load('~/venv/modelling/renv')
* Project '~/venv/modelling/renv' loaded. [renv 0.15.5]
> .libPaths()
[1] "/gpfs0/home/user/venv/modelling/renv/renv/library/R-4.0/x86_64-pc-linux-gnu"         
[2] "/gpfs0/global/software/easybuild-broadwell/software/R/4.0.4-foss-2020b-2/lib64/R/library"

after loading rasterVis

> sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /gpfs0/global/software/easybuild-broadwell/software/OpenBLAS/0.3.12-GCC-10.2.0/lib/libopenblas_haswellp-r0.3.12.so

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=de_DE.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rasterVis_0.50      latticeExtra_0.6-29 lattice_0.20-41    
[4] terra_1.1-4         raster_3.4-5        sp_1.4-5           

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6         codetools_0.2-18   zoo_1.8-9          png_0.1-7         
 [5] viridisLite_0.3.0  grid_4.0.4         renv_0.15.5        hexbin_1.28.2     
 [9] RColorBrewer_1.1-2 tools_4.0.4        jpeg_0.1-8.1       parallel_4.0.4    
[13] compiler_4.0.4 

Do you know why it loads correctly renv but not my corresponsing library versions?


Solution

  • In this call:

    renv::load('~/venv/modelling/renv')

    I believe you want to use this instead:

    renv::load('~/venv/modelling')

    since the path supplied to renv::load() should be the project root, not the renv folder within the project.