r Permission denied loading gganimate - r

follow my previous question, now I am able to manually download gganimate and unzip to my PC. When I try to load h package, there is an error:
shell("R CMD build gganimate")
checking for file 'gganimate/DESCRIPTION' ... OK
preparing 'gganimate':
checking DESCRIPTION meta-information ... OK
checking for LF line-endings in source and make files and shell scripts
checking for empty or unneeded directories
building 'gganimate_0.9.9.9999.tar.gz'
Warning in gzfile(tarfile, "wb", compression = compression_level) :
cannot open compressed file 'C:/Program Files/R/R-3.5.1/library/gganimate_0.9.9.9999.tar.gz',
probable reason 'Permission denied'
Error in gzfile(tarfile, "wb", compression = compression_level) :
cannot open the connection
Execution halted
Warning message:
In shell("R CMD build gganimate") :
'R CMD build gganimate' execution failed with error code 1
Tried to turn off antivus, but it won't help:
trace(utils:::unpackPkgZip, quote(Sys.sleep(2)), at = which(grepl("Sys.sleep",
body(utils:::unpackPkgZip), fixed = TRUE)))

Related

Issues installing CausalImpact in R

I am trying to install the Causal Impact package in R and get the following warnings/errors:
install.packages("CausalImpact")
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file 'C:/Users/nlwes/AppData/Local/Programs/R/R-4.2.0/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://mirror.dogado.de/cran/src/contrib:
cannot open URL 'https://mirror.dogado.de/cran/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirror.dogado.de/cran/bin/windows/contrib/4.2:
cannot open URL 'https://mirror.dogado.de/cran/bin/windows/contrib/4.2/PACKAGES'
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'SSL peer certificate or SSH remote key was not OK'
2: package ‘CausalImpact’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Anybody an idea how to fix the issue so I can install the package?

How set new path to the newly Updated RTools40?

After updating R to 4.0.3 and RStudio to the newest version, I have issues with the cointegration of RStudio and RTools described in these questions (before R was 3.6 and RTools 35 and everything worked fine):
https://community.rstudio.com/t/problems-with-r-4-0-0-windows-error-package-or-namespace-load-failed-for-stats-in-indl-x-as-logical-local-as-logical-now/62958/6
https://community.rstudio.com/t/rtools-not-found-after-r-4-0-0-installation/63356/3
I found that I should set some environmental variables for my user. However, I do not understand how to do it, despite the fact that the new path to RTolls should have path C:\rtools40\usr\bin (with older Rtools version it is C:\RTools\bin. Could you help with that?
Additionally,I did these steps, but then got error when downloading package
> Sys.setenv(PATH = paste("C:/rtools40/usr/bin", Sys.getenv("PATH"), sep=";"))
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets#HEAD
√ checking for file 'C:\Users\NAME\AppData\Local\Temp\RtmpSMB4KM\remotes2bcc582622c6\brettjbush-R-Websockets-fc7ee9c/DESCRIPTION' (598ms)
- preparing 'websockets':
√ checking DESCRIPTION meta-information ...
- cleaning src
Warning in system2(command, args, stdout = NULL, stderr = NULL, ...) :
'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "C:/PROGRA~1/R/R-40~1.3/share/make/clean.mk" -f Makevars.win clean'
Then I tried following and got different error
> Sys.setenv(PATH = paste("C:/rtools40/usr/bin", Sys.getenv("PATH"), sep=";"))
> Sys.setenv(BINPREF = "C:/rtools40/mingw_$(WIN)/bin/")
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets#HEAD
brettjbush-R-Websockets-fc7ee9c/man/websocket_close.Rd: truncated gzip input
tar.exe: Error exit delayed from previous errors.
Error: Failed to install 'websockets' from GitHub:
Does not appear to be an R package (no DESCRIPTION)
In addition: Warning messages:
1: In utils::untar(tarfile, ...) :
‘tar.exe -xf "C:\Users\NAME\AppData\Local\Temp\RtmpSMB4KM\file2bccd21558.tar.gz" -C "C:/Users/NAME/AppData/Local/Temp/RtmpSMB4KM/remotes2bcc2b6a75d4"’ returned error code 1
2: In system(cmd, intern = TRUE) :
running command 'tar.exe -tf "C:\Users\NAME\AppData\Local\Temp\RtmpSMB4KM\file2bccd21558.tar.gz"' had status 1

When building R package, devtools::check() throw 'Permission Denied' error

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.

Error knitting file in RStudio

I am getting this error when I attempt to knit any markdown file in RStudio.
Error in system(paste(shQuote(pandoc_path), "--version"), intern = TRUE) :
'CreateProcess' failed to run 'C:\PROGRA~1\RStudio\bin\pandoc\pandoc.exe --version'
Calls: ... get_pandoc_version -> with_pandoc_safe_environment -> force -> system
Execution halted
pandoc.exe is in the path shown by the error message.
I also have a stand-alone installation of pandoc and have used the following command to point to that version
Sys.setenv(RSTUDIO_PANDOC = "C:/Program Files (x86)/Pandoc")
Doing that however results in the same error except that the path
"C:\PROGRA~1\RStudio\bin\pandoc\pandoc.exe" changes to "C:\PROGRA~2\pandoc\pandoc.exe"
I am running Windows 10 and the latest versions of RStudio and R.

Installing ggbiplot from github

I'm trying to install development version of ggbiplotfrom Github. During installation I'm getting the following error message:
library(devtools)
install_github("ggbiplot", "vqv")
Installing github repo(s) ggbiplot/master from vqv
Installing ggbiplot.zip from https://github.com/vqv/ggbiplot/zipball
Installing ggbiplot
* checking for file 'C:\Users\Muhammad Yaseen\AppData\Local\Temp\Rtmpsx4n5u\vqv-ggbiplot-2623d7c/DESCRIPTION' ... OK
* preparing 'ggbiplot':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'ggbiplot_0.5.tar.gz'
cygwin warning:
MS-DOS style path detected: C:/Users/MUHAMM~1/AppData/Local/Temp/Rtmpsx4n5u/ggbiplot_0.5.tar.gz
Preferred POSIX equivalent is: /cygdrive/c/Users/MUHAMM~1/AppData/Local/Temp/Rtmpsx4n5u/ggbiplot_0.5.tar.gz
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Warning: invalid package 'Yaseen/R/win-library/2.14'
Error: ERROR: cannot cd to directory 'C:/Users/Muhammad'
Error: Command failed (1)
In addition: Warning message:
running command '"C:/PROGRA~1/R/R-214~1.2/bin/i386/R" CMD INSTALL C:\Users\MUHAMM~1\AppData\Local\Temp\Rtmpsx4n5u/ggbiplot_0.5.tar.gz --library=C:/Users/Muhammad Yaseen/R/win-library/2.14' had status 1
Any idea to figure out this problem. Thanks in advance for your help and time.
Edit
After downloading from Github, also tried
install.packages("vqv-ggbiplot-2623d7c.tar.gz", repos=NULL, type="source")
which produced this error message
Installing package(s) into ‘C:/Users/Muhammad Yaseen/R/win-library/2.14’
(as ‘lib’ is unspecified)
Error in untar2(tarfile, files, list, exdir) : unsupported entry type 'g'
Warning messages:
1: running command 'C:/PROGRA~1/R/R-214~1.2/bin/i386/R CMD INSTALL -l "C:/Users/Muhammad Yaseen/R/win-library/2.14" "vqv-ggbiplot-2623d7c.tar.gz"' had status 1
2: In install.packages("vqv-ggbiplot-2623d7c.tar.gz", repos = NULL, :
installation of package ‘vqv-ggbiplot-2623d7c.tar.gz’ had non-zero exit status
It's because your Rlib path has a space in it: C:/Users/Muhammad Yasseen/R/win-library/2.14.
See how in the first error log the warning message was
running command '"C:/PROGRA~1/R/R-214~1.2/bin/i386/R" CMD INSTALL
C:\Users\MUHAMM~1\AppData\Local\Temp\Rtmpsx4n5u/ggbiplot_0.5.tar.gz
--library=C:/Users/Muhammad Yaseen/R/win-library/2.14'
had status 1
In particular, the --library=C:/Users/Muhammad Yaseen/R/win-library/2.14.
This should be --library="C:/Users/Muhammad Yaseen/R/win-library/2.14" to deal with the space.
Using install.packages takes care of the quotes for you - see how your second warning message (when you used install.packages) was
running command 'C:/PROGRA~1/R/R-214~1.2/bin/i386/R CMD INSTALL
-l "C:/Users/Muhammad Yaseen/R/win-library/2.14"
"vqv-ggbiplot-2623d7c.tar.gz"' had status 1
The -l "C:/Users/Muhammad Yasseen/R/win-library/2.14" has quote marks around it, so you don't get the same error.
I had a quick look at the install-github sources, and it constructs the R CMD INSTALL command via:
paste("CMD INSTALL ", built_path, " --library=", .libPaths()[1], sep="")
See how it doesn't surround .libPaths()[1] by double quotes in case of spaces? I'd guess that's your problem.
As to a fix - there seems to be an error using install.packages() on a tar file generated by git (as reported here). So, you can either:
change your R library location to somewhere without spaces
unzip the .tar.gz file (I don't know what software does this on Windows) and install from the extracted directories rather than the .tar.gz.
You can't unzip the .tar.gz because it cleans up that file quicker than you can grab it (I've watched it appear and get deleted again). Correct me if I'm wrong, but I also can't get devtools from github for teh same reason :S

Resources