rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
995 stars 153 forks source link

Problem with renv::install() windows 10 #851

Closed wfmueller29 closed 1 year ago

wfmueller29 commented 2 years ago

Hi,

I am a new renv user and am trying to install the packages tidyverse and ggplot2 into my project library, but I am getting errors when trying to install. Below I have attached sessions info, renv::diagnostics() output, and both errors. I am also getting a similiar error when I call renv::init(). Any help would be much appreciated!

Session info

R version 4.1.1 (2021-08-10)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1    renv_0.14.0  

Renv Diagnostics:

  > renv::diagnostics()
  Diagnostics Report [renv 0.14.0]
  ================================

  # Session Info =======================
  R version 4.1.1 (2021-08-10)
  Platform: i386-w64-mingw32/i386 (32-bit)
  Running under: Windows 10 x64 (build 19042)

  Matrix products: default

  locale:
  [1] LC_COLLATE=English_United States.1252 
  [2] LC_CTYPE=English_United States.1252   
  [3] LC_MONETARY=English_United States.1252
  [4] LC_NUMERIC=C                          
  [5] LC_TIME=English_United States.1252    

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

  loaded via a namespace (and not attached):
  [1] compiler_4.1.1 tools_4.1.1    renv_0.14.0   

  # Project ============================
  Project path: "M:/Postbacs/Billy/programs/mousechart"

  # Status =============================
  The following package(s) are no longer used in this project:
            _
    MASS      [7.3-54]
    Matrix    [1.3-4]
    foreign   [0.8-81]
    lattice   [0.20-44]
    mgcv      [1.8-36]
    nlme      [3.1-152]
    nnet      [7.3-16]

  Use `renv::snapshot()` to remove them from the lockfile.

  The following package(s) are used in the project, but are not installed:

      ggplot2
      ggpubr
      shiny
      shinyWidgets
      tidyverse

  Consider installing these packages, and then using `renv::snapshot()`
  to record these packages in the lockfile.

  # Packages ===========================
               Library Source Lockfile Source Path Dependency
  KernSmooth   2.23-20   CRAN     <NA>   <NA>  [2]       <NA>
  MASS          7.3-54   CRAN   7.3-54   CRAN  [2]       <NA>
  Matrix         1.3-4   CRAN    1.3-4   CRAN  [2]       <NA>
  boot          1.3-28   CRAN     <NA>   <NA>  [2]       <NA>
  class         7.3-19   CRAN     <NA>   <NA>  [2]       <NA>
  cluster        2.1.2   CRAN     <NA>   <NA>  [2]       <NA>
  codetools     0.2-18   CRAN     <NA>   <NA>  [2]       <NA>
  digest        0.6.28   CRAN     <NA>   <NA>  [1]       <NA>
  foreign       0.8-81   CRAN   0.8-81   CRAN  [2]       <NA>
  ggplot2         <NA>   <NA>     <NA>   <NA> <NA>     direct
  ggpubr          <NA>   <NA>     <NA>   <NA> <NA>     direct
  lattice      0.20-44   CRAN  0.20-44   CRAN  [2]       <NA>
  mgcv          1.8-36   CRAN   1.8-36   CRAN  [2]       <NA>
  nlme         3.1-152   CRAN  3.1-152   CRAN  [2]       <NA>
  nnet          7.3-16   CRAN   7.3-16   CRAN  [2]       <NA>
  renv          0.14.0   CRAN   0.14.0   CRAN  [1]     direct
  rpart         4.1-15   CRAN     <NA>   <NA>  [2]       <NA>
  shiny           <NA>   <NA>     <NA>   <NA> <NA>     direct
  shinyWidgets    <NA>   <NA>     <NA>   <NA> <NA>     direct
  spatial       7.3-14   CRAN     <NA>   <NA>  [2]       <NA>
  survival      3.2-11   CRAN     <NA>   <NA>  [2]       <NA>
  tidyverse       <NA>   <NA>     <NA>   <NA> <NA>     direct
  utils           <NA>   <NA>     <NA>   <NA>  [2]   indirect

  [1]: M:/Postbacs/Billy/programs/mousechart/renv/library/R-4.1/i386-w64-mingw32
  [2]: C:/Users/muellerwf/AppData/Local/Temp/Rtmpc7LCie/renv-system-library     

  # User Profile =======================
  [no user profile detected]

  # Settings ===========================
  List of 8
   $ external.libraries       : chr(0) 
   $ ignored.packages         : chr(0) 
   $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
   $ r.version                : chr(0) 
   $ snapshot.type            : chr "implicit"
   $ use.cache                : logi TRUE
   $ vcs.ignore.library       : logi TRUE
   $ vcs.ignore.local         : logi TRUE

  # Options ============================
  List of 9
   $ defaultPackages                     : chr [1:6] "datasets" "utils" "grDevices" "graphics" ...
   $ download.file.method                : NULL
   $ download.file.extra                 : NULL
   $ install.packages.compile.from.source: chr "interactive"
   $ pkgType                             : chr "both"
   $ repos                               : Named chr "http://cran.rstudio.com"
    ..- attr(*, "names")= chr "CRAN"
   $ renv.consent                        : logi TRUE
   $ renv.config.cache.symlinks          : logi TRUE
   $ renv.verbose                        : logi TRUE

  # Environment Variables ==============
  HOME                        = C:\Users\muellerwf\Documents
  LANG                        = <NA>
  MAKE                        = <NA>
  R_LIBS                      = <NA>
  R_LIBS_SITE                 = <NA>
  R_LIBS_USER                 = M:/Postbacs/Billy/programs/mousechart/renv/library/R-4.1/i386-w64-mingw32;C:/Users/muellerwf/AppData/Local/Temp/Rtmpc7LCie/renv-system-library
  RENV_DEFAULT_R_ENVIRON      = <NA>
  RENV_DEFAULT_R_ENVIRON_USER = <NA>
  RENV_DEFAULT_R_LIBS         = <NA>
  RENV_DEFAULT_R_LIBS_SITE    = <NA>
  RENV_DEFAULT_R_LIBS_USER    = C:/Users/muellerwf/Documents/R/win-library/4.1
  RENV_DEFAULT_R_PROFILE      = <NA>
  RENV_DEFAULT_R_PROFILE_USER = <NA>
  RENV_PROJECT                = M:/Postbacs/Billy/programs/mousechart

  # PATH ===============================
  - C:\rtools40\usr\bin
  - C:\rtools40\usr\bin
  - C:\Users\muellerwf\Documents\R\R-4.1.1\bin\i386
  - C:\Program Files (x86)\Common Files\Oracle\Java\javapath
  - C:\WINDOWS\system32
  - C:\WINDOWS
  - C:\WINDOWS\System32\Wbem
  - C:\WINDOWS\System32\WindowsPowerShell\v1.0\
  - C:\WINDOWS\System32\OpenSSH\
  - C:\Program Files (x86)\Webex\Webex\Applications
  - C:\Program Files (x86)\HID Global\ActivClient\
  - C:\Program Files\HID Global\ActivClient\
  - C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
  - C:\Program Files\MATLAB\R2020b\bin
  - C:\Users\muellerwf\AppData\Local\Microsoft\WindowsApps
  - C:\Users\muellerwf\AppData\Local\Programs\Git\cmd
  - C:\Users\muellerwf\AppData\Local\Programs\MiKTeX\miktex\bin\x64\
  - C:\Users\muellerwf\AppData\Local\Programs\MiKTeX32bit\miktex\bin\
  - C:\Users\muellerwf\Vim\vim82\
  - C:\Users\muellerwf\Miniconda3

  # Cache ==============================
  There are a total of 9 package(s) installed in the renv cache.
  Cache path: "C:/Users/muellerwf/AppData/Local/R/cache/R/renv/cache/v5/R-4.1/i386-w64-mingw32"

Error 1:

> renv::install("tidyverse")
  Error: could not copy / move file 'M:/Postbacs/Billy/programs/mousechart/renv/staging/1/ellipsis' to 'M:/Postbacs/Billy/programs/mousechart/renv/staging/1\.renv-backup-ellipsis248038705a68'
  move: cannot rename file 'M:/Postbacs/Billy/programs/mousechart/renv/staging/1/ellipsis' to 'M:/Postbacs/Billy/programs/mousechart/renv/staging/1\.renv-backup-ellipsis248038705a68', reason 'The system cannot find the file specified'
  copy: source file 'M:/Postbacs/Billy/programs/mousechart/renv/staging/1/ellipsis' does not exist
  Traceback (most recent calls last):
  15: renv::install("tidyverse")
  14: renv_install_impl(records)
  13: renv_install_staged(records)
  12: renv_install_default(records)
  11: handler(package, renv_install_package(record))
  10: renv_install_package(record)
   9: renv_cache_synchronize(record, linkable = linkable)
   8: renv_cache_synchronize_impl(cachePath, record, linkable, path)
   7: renv_file_link(cache, path, overwrite = TRUE)
   6: renv_file_copy(source, target, overwrite = overwrite)
   5: renv_file_preface(source, target, overwrite)
   4: renv_file_backup(target)
   3: renv_file_move(path, tempfile)
   2: stopf(text, source, target)
   1: stop(sprintf(fmt, ...), call. = call.)

Error 2:

> renv::install("ggplot2")
Retrieving 'http://cran.rstudio.com/bin/windows/contrib/4.1/withr_2.4.2.zip' ...
    OK [file is up to date]
Installing glue [1.4.2] ...
Error: target file 'M:/Postbacs/Billy/programs/mousechart/renv/staging/1/glue' already exists
Traceback (most recent calls last):
12: renv::install("ggplot2")
11: renv_install_impl(records)
10: renv_install_staged(records)
 9: renv_install_default(records)
 8: handler(package, renv_install_package(record))
 7: renv_install_package(record)
 6: renv_install_package_cache(record, path, linker)
 5: linker(cache, target)
 4: renv_file_copy(source, target, overwrite = overwrite)
 3: renv_file_preface(source, target, overwrite)
 2: stopf("target file '%s' already exists", target)
 1: stop(sprintf(fmt, ...), call. = call.)
kevinushey commented 2 years ago

Sorry to hear you're having trouble! Is M:/ a local drive, or a network drive?

What if you set the following option first; e.g.

options(renv.config.install.staged = FALSE)
renv::install("ggplot2")
wfmueller29 commented 2 years ago

Thank you for the prompt response!

M:/ is a network drive

I just tried what you recommended and I got the same error as in error 2 above.

kevinushey commented 2 years ago

I think the issue here might be that the renv cache is located on a different volume than the project, and you have:

$ renv.config.cache.symlinks : logi TRUE

set in your options. I suspect renv is trying to create a junction point from the cache on C:/ to the network drive on M:/, and that is failing.

Do you have better luck with:

options(renv.config.cache.symlinks = FALSE)
renv::install("ggplot2")

Or, alternatively, is placing the renv cache somewhere on the M:/ drive an option? See https://rstudio.github.io/renv/reference/paths.html for more details. In particular, you might try setting the environment variable:

RENV_PATHS_ROOT = M:/Postbacs/Billy/renv

within the file located at ~/.Renviron or something similar.

kaijagahm commented 1 year ago

Just commenting to say that the options(renv.config.cache.symlinks = FALSE) line worked for me with this same issue--getting packages to install on a network drive. Thanks @kevinushey.