Spaces in library path names (on Windows) causes problems installing packages after installing R 3.5.0


Since installing R 3.5.0 I have a problem installing/updating/building packages that go into the library path of my user account. I give some detailed error messages below. Any help appreciated.

To summarize, the warnings show a split in the library path at the space in my username (I use Windows10). (I also notice the use of both "/" and "\" but do't know what that means.

Warning: invalid package 'C:\Users\Neil'
Warning: invalid package 'Caithness\AppData\Local\Temp\RtmpaangbE/downloaded_packages/stringi_1.2.2.tar.gz'

My library paths are:

> .libPaths()
[1] "C:/Users/Neil Caithness/Documents/R/win-library/3.5"
[2] "C:/Program Files/R/R-3.5.0/library"                 

Detailed messages below. Installing devtools seems to work, but stringi and many others don't.

(PS. Edit. It's not the library path that causes the problem, but the path to the downloaded source package. This is a .gz file for stringi, but a .zip file for devtools. Does that mean something? I also get the same problem when I try to build any of my own packages.)

(PPS. Simply reverting to previous versions of R doesn't solve the problem (3.4.4, 3.4.0) but I know that up until about last week it was fine. So at the moment I don't know what changes could have caused this, or what to do about it? )

> install.packages("devtools")
Installing package into ‘C:/Users/Neil Caithness/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL ''
Content type 'application/zip' length 701514 bytes (685 KB)
downloaded 685 KB

package ‘devtools’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Neil Caithness\AppData\Local\Temp\RtmpaangbE\downloaded_packages

> install.packages("stringi")
Installing package into ‘C:/Users/Neil Caithness/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
        binary source needs_compilation
stringi  1.1.7  1.2.2              TRUE

installing the source package ‘stringi’

trying URL ''
Content type 'application/x-gzip' length 7270627 bytes (6.9 MB)
downloaded 6.9 MB

Warning: invalid package 'C:\Users\Neil'
Warning: invalid package 'Caithness\AppData\Local\Temp\RtmpaangbE/downloaded_packages/stringi_1.2.2.tar.gz'
Error: ERROR: no packages specified
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\Neil Caithness\AppData\Local\Temp\RtmpaangbE\downloaded_packages’

Issues with packages after updating to R 3.5.0

It seems that the space in your folder "Neil Caithness" was the problem


You can try to install failed packages in different folder without any space or any special characters to see if the problem go away. See this link for more information


Thanks for the suggestion. I tried that (setting R_LIBS_USER to something nearer the drive root, but the problem occurs with .gz downloads and I can't see how to direct those somewhere else. I think it has something to do with the application/x-gzip mime type. Perhaps installing and uninstalling various zip programs has corrupted the registry - but I don't yet know how to find out.

Warning: invalid package 'C:\Users\Neil'
Warning: invalid package 'Caithness\AppData\Local\Temp\RtmpCgQfR8/downloaded_packages/cartogram_0.0.3.tar.gz'
Error: ERROR: no packages specified


Then download package zip/tar.gz and choose install from package archive?

See also:


Thanks for the help. The space in the folder name is indeed the problem. I created a new account with no spaces in the home folder name, and all of the (650+) packages I had previously installed reinstall to the new location without (much) problem. Except 'stringi', which for some reason won't update from CRAN, but I think that must be a different problem.

At least I learned a lot about paths and order of execution at startup. So thanks again.


My pleasure! I remember having problem with stringi too. I eventually found out the reason was due to setwd in my .Rprofile file