rappdirs not finding win_path when running from command line
fermumen opened this issue · 5 comments
I'm getting an error from rappdirs when trying to run a script based on AzureVM. This is the error I get, I'm asuming it can't find the auth cache location? How could I fix it?
"Rscript.exe" "main.R"
Error: package or namespace load failed for 'AzureVM':
.onLoad failed in loadNamespace() for 'AzureAuth', details:
call: .Call("win_path", csidl, PACKAGE = "rappdirs")
error: "win_path" not available for .Call() for package "rappdirs"
Execution halted
I'm running from PowerShell on Windows with this session info
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] AzureRMR_2.3.4 AzureVM_2.1.1
loaded via a namespace (and not attached):
[1] compiler_4.0.2 R6_2.4.1 tools_4.0.2 rappdirs_0.3.1
[5] AzureAuth_1.2.4
I can't repro this. Can you provide a reproducible example? I assume you're calling an R file using Rscript.exe, from within a Powershell script?
Also, does AzureAuth work correctly in an interactive session?
Hi,
I tried to reproduce it on another machine and it was all working. This must be an edge case generated by my workplace virtualized environment.
My Rscript.exe call is:
C:\ProgramData\App-V\8A6DA061-8C87-48F2-9868-6FDB6343D4F7\230E76A8-6D41-430E-85D7-6E404165F588\Root\R-4.0.2\bin\Rscript.exe "path/to/script.R"
AzureAuth works correctly from an interactive session and finds the Azure_dir in :
C:\Users\<MyUser>\AppData\Local\Microsoft\AppV\Client\VFS\8A6DA061-8C87-48F2-9868-6FDB6343D4F7\Local AppData\AzureR
Somehow when I run Rscript from the command line (running just AzureAuth::Azure_dir()
) it gives me the above error.
It seems that these are more likely than not part of the virtual app configuration. Is there a way to hardcode into the script the Azure_dir()?
This seems to be more likely a problem with the rappdirs package. See if the following works:
rappdirs::user_data_dir(appname="AzureR", appauthor="", roaming=FALSE)
Right now there's no way to hardcode the cache directory. I'll add that to the next version.
In the meantime, you could create a dummy rappdirs package that just returns a fixed value when you call the above function. I don't think many other packages use it, so you should be safe.
You are right, it is a rappdirs
issue.
PS C:> &"C:\ProgramData\App-V\8A6DA061-8C87-48F2-9868-6FDB6343D4F7\230E76A8-6D41-430E-85D7-6E404165F588\Root\R-4.0.2\bin\Rscript.exe" -e "rappdirs::user_data_dir(appname='AzureR', appauthor='', roaming=FALSE)"
Error in .Call("win_path", csidl, PACKAGE = "rappdirs") :
"win_path" not available for .Call() for package "rappdirs"
Calls: ... do.call -> as.list -> win_path -> %||% -> win_path_csidl
Execution halted
Thanks for the suggestion for the dummy package and for your help!
Actually, you could also try installing rappdirs 0.3.2. This lets you specify the directory in the R_USER_DATA_DIR
environment variable, maybe that will bypass the offending C code.