0

Over the past years, I built a R package and regularly updated it in Windows 7 Enterprise. Everything was working fine until November 2017 when the company upgraded my desktop. I got a brand new machine with windows 10. As 'permission' issue is kind of common, so I as usual installed R, Rstudio, Rtools into a folder I have write access. But when I tried to build the package in Rstudio, I got the below error:

==> devtools::check()

Updating RCfun documentation
Loading RCfun
Setting env vars --------------------------------------------------------------
CFLAGS  : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building RCfun ----------------------------------------------------------------
"C:/R/R-34~1.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore  \
--quiet CMD build "Z:\_R\R_package\RCfun" --no-resave-data --no-manual 

* checking for file 'Z:\_R\R_package\RCfun/DESCRIPTION' ... OK
* preparing 'RCfun':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'RCfun_0.1.1.tar.gz'
Warning in gzfile(tarfile, "wb", compression = compression_level) :
cannot open compressed file 'C:/Windows/System32/RCfun_0.1.1.tar.gz', 
probable reason 'Permission denied'
Error in gzfile(tarfile, "wb", compression = compression_level) : 
cannot open the connection
Execution halted
Error: Command failed (1)
Execution halted

Exited with status 1.

Clearly, I don't have access to the folder 'C:/Windows/System32/'. I can't change that and I am aware of that, so I installed R related stuff all in a folder I have access to. But the question is, why it still attempts to write the file RCfun_0.1.1.tar.gz into the folder 'C:/Windows/System32/' when building the package? Where can I change/overwrite that behavior?

I have searched for answers from time to time for the past a couple of month, but got no luck. I found something similar in this thread: permission denied error while building/checking R package on WIndows but it doesn't solve my case.

I know it must be related to some system path that directs to this folder 'C:/Windows/System32/'. I tried Sys.setenv(PATH=) to remove that folder. I'm not sure if that's the correct way, but it doesn't help anyway. Is there a way that I can catch where it goes wrong? Thanks.

  • If there is really a space in `Z:/_R/R package/`, I suggest you try building it in a location without a space in the path. (This is a bug that has plagued R on windows for many years.) – r2evans Jan 24 '18 at 16:31
  • thanks, r2evans. That's a good suggestion. But I don't think that is the reason... First, it was working before in Windows 7 Enterprise with that space in the folder name. Second, I just removed that space and still got the same. Let me integrate the update into my original question. – user9262967 Jan 24 '18 at 16:56
  • Does the `.tar.gz` file already exist? Is it locked by another process? Have you tried restarting R (or even windows)? Sorry, taking stabs, no solid idea yet. – r2evans Jan 24 '18 at 17:25

0 Answers0