Reputation: 23
I'm working with the devtools package in R, and I'm trying to use it to install a GitHub repo for my class. However, I have a path with spaces in it, and here is the error message I'm getting:
Installing package into ‘C:/Users/Kaelan McGurk/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'buildings' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Fatal error: cannot open file 'C:\Users\Kaelan': No such file or directory
But here is the output of Sys.getenv("PATH")
:
C:\\Program Files\\R\\R-3.6.0\\bin\\x64;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\PharosSystems\\Core;C:\\Program Files (x86)\\Skype\\Phone\\;C:\\Program Files\\PuTTY\\;C:\\Program Files (x86)\\Wolfram Research\\WolframScript\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\MySQL\\MySQL Shell 8.0\\bin\\;C:\\Users\\Kaelan McGurk\\Documents\\MATH335\\M335_WI20_McGurk_Kael\\%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps
So I'm not sure what's going on here,
How can I avoid the fatal error "cannot open file"
Upvotes: 2
Views: 502
Reputation: 476
Honestly, because your Windows configuration probably doesn't allow for it, I wouldn't suggest doing the above answer. IF YOU CAN, I would suggest making a local Windows user admin account called like "kaelanr" or something like that, and then copy all of your R files over to there, instead of trying to fight with changing names and stuff like that.
Upvotes: 1
Reputation: 1464
First of all the %PATH% is not of much use in that case. Second - a solution for working with windows directory paths that I usually apply is running dir /X
command in a windows cmd prompt, since that will show you short directory names (eg for 'Program Files' it will show you PROGRA~1).
Still this will not solve your current issue imho. But potentially the following could - I haven't tested it on a WIN machine for now but try the following (in R):
.libPaths('C:/Users/Kaelan~1/Documents/R/win-library/3.6')
IMPORTANT replace Kaelan~1 here with whatever dir /X
showed you as the short name for your directory. Then retry the package installation.
If that fixes your issue potentially put that line in your ~/.Rprofile
for now, before you change your User account name to simply Kaelan ;-)
Upvotes: 1