2

I'm trying to execute renv::snapshot() and i'm getting

Error in file.exists(children) : 
  file name conversion problem -- name too long?

I'm on Windows 10 and i can't find any issue with the project's dir path name (C:\Users\alber\OneDrive\Documentos\R\manual).

What else can it be?

EDIT - renv::diagnostics()

Obs.: since my Project is in an OneDrive folder, i could open it in another machine and it worked. I noticed that in that other machine the Project path is full (C:/...) while in this machine it starts with ~/. Maybe that's it?

Diagnostics Report -- renv [0.10.0-42]
======================================

# Session Info =======================
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252   
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C                      
[5] LC_TIME=Portuguese_Brazil.1252    

... 

# Project ============================
Project path: "~/R/manual_assessorias"

...

# Packages ===========================
The project library "~/R/manual_assessorias/renv/library/R-4.0/x86_64-w64-mingw32" does not exist.
...

# User Profile =======================
[no R packages referenced in user profile

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

# Options ============================
List of 1
 $ renv.verbose: logi TRUE

# Environment Variables ==============
HOME        = C:\Users\alber\OneDrive\Documentos
LANG        = <NA>
R_LIBS      = <NA>
R_LIBS_SITE = <NA>
R_LIBS_USER = C:/Users/alber/OneDrive/Documentos/R/win-library/4.0

# PATH ===============================
- C:\Program Files\R\R-4.0.0\bin\x64
- 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\Git\cmd
- C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
- C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
- C:\Users\alber\AppData\Local\Microsoft\WindowsApps
- C:\Users\alber\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\

# Cache ==============================
There are a total of 0 package(s) installed in the renv cache.
Cache path: "C:/Users/alber/AppData/Local/renv/cache/v5/R-4.0/x86_64-w64-mingw32"
Alberson Miranda
  • 1,248
  • 7
  • 25
  • Try to first run `setwd(Sys.getenv("HOME"))` to change the working directory and then run `renv::snapshot()`. If that works, the issue is probably related with the project path. – Gorka May 27 '20 at 00:13
  • Did that and the project path became only "~" (didn't work). Quite frustrating. Guess my issue now is how to set full path instead of relative. – Alberson Miranda May 27 '20 at 04:08
  • Notice: i've got the issue in my personal laptop with R 4.0. Then i've tried in my company laptop with R 3.6 and it worked. Now i just tested in my PC also with R 4.0 and got the same error. Now i'm scared :D – Alberson Miranda May 27 '20 at 04:52
  • Are you using Rstudio? Can you change the working directory using Session>Set Working Directory>Choose Directory? – Gorka May 27 '20 at 15:39

1 Answers1

0

Seems that your problem is due to some package dependencies are installed in a path with non-English characters.

https://github.com/rstudio/renv/blob/9298efabca69803bb808a4bc3c3311b5c98f706f/R/dependencies.R#L265

# return the set of files / subdirectories within a directory that should be
# crawled for dependencies
renv_dependencies_find_dir_children <- function(path, root) {

  # list files in the folder
  children <- renv_file_list(path, full.names = TRUE)

  # remove files which are broken symlinks
  children <- children[file.exists(children)]

  # remove hard-coded ignores
  ignored <- c("renv")
  children <- children[!basename(children) %in% ignored]

  # construct pattern for matching files in this path
  # (return all files if no such pattern available)
  renv_renvignore_exec(path, root, children)

}
Gorka
  • 1,971
  • 1
  • 13
  • 28