Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
302 views
in Technique[技术] by (71.8m points)

r - How to resolve install_github fails with error System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr?

I wonder if anyone can help me solve an issue I'm having with install_github. Whether I use remotes::install_github or devtools::install_github, I get the following error message that reads "System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr":

devtools::install_github("DenaJGibbon/gibbonR-package")
Downloading GitHub repo DenaJGibbon/gibbonR-package@HEAD
   The system cannot find the path specified.
√  checking for file 'C:UsersAvaAppDataLocalTempRtmpQbOqhX
emotes11d83d647a58DenaJGibbon-gibbonR-package-47acbc3/DESCRIPTION' ...
-  preparing 'gibbonR':
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'gibbonR_0.0.0.9000.tar.gz'
   
Error: Failed to install 'gibbonR' from GitHub:
  System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> The system cannot find the path specified.
E> * checking for file 'C:UsersAvaAppDataLocalTempRtmpQbOqhX
emotes11d83d647a58DenaJGibbon-gibbonR-package-47acbc3/DESCRIPTION' ... OK
E> * preparing 'gibbonR':
E> * checking DESCRIPTION meta-information ... OK
E> * checking for LF line-endings in source and make files and shell scripts
E> * checking for empty or unneeded directories
E> * building 'gibbonR_0.0.0.9000.tar.gz'
E>

I thought this had to do with my path specifications and devtools/rtools, so in the end I did a fresh install of rtools and the whole setup procedure. Here's my system and path specs, and what I did:

  • Windows 10 64-bit and R Studio Version 1.4.1103
> version
_
platform       x86_64-w64-mingw32
arch           x86_64
os             mingw32
system         x86_64, mingw32
status
major          4
minor          0.2
year           2020
month          06
day            22
svn rev        78730
language       R
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again
  1. Downloaded Rtools (rtools40-x86_64.exe) from https://cran.r-project.org/bin/windows/Rtools/

  2. Added Rtools to my path, which now looks like:

> writeLines(strsplit(Sys.getenv("PATH"), ";")[[1]])
C:Program FilesRR-4.0.2inx64
C:Program FilesRR-4.0.2inx64
C:
tools40usrin
C:
tools40mingw64in
  1. For good measure, created an .Renviron file in C:UsersAvaDocuments, that includes the line PATH=${RTOOLS40_HOME}usrin;${PATH} Exactly as shown - but I wasn't sure if I should have pasted the path to Rtools in the first variable...)

  2. Checking that Rtools is recognized:

> Sys.which("make")
make 
"C:\rtools40\usr\bin\make.exe"

> pkgbuild::check_rtools(TRUE)
Found in Rtools 4.0 installation folder
[1] TRUE

 > pkgbuild::has_rtools(TRUE)
Found in Rtools 4.0 installation folder
[1] TRUE

> pkgbuild::has_build_tools(debug=TRUE)
Found in Rtools 4.0 installation folder
[1] TRUE

> devtools::find_rtools(debug=TRUE)
Found in Rtools 4.0 installation folder
[1] TRUE

# After manually adding  C:
tools40mingw64in to a new env variable BINPREF: 
> Sys.getenv("BINPREF")
[1] "C:\rtools40\mingw64\bin"

Yet, calls to devtools still fails with the same error message. I also don't understand this since Rcmd.exe is indeed on the path, at C:Program FilesRR-4.0.2inx64

> devtools::install_github("DenaJGibbon/gibbonR-package", build_vignettes = FALSE)
Downloading GitHub repo DenaJGibbon/gibbonR-package@HEAD
The system cannot find the path specified.
√  checking for file 'C:UsersAvaAppDataLocalTempRtmpYHUJJi
emotes5f8032964d86DenaJGibbon-gibbonR-package-47acbc3/DESCRIPTION' ...
-  preparing 'gibbonR':
  √  checking DESCRIPTION meta-information ...
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'gibbonR_0.0.0.9000.tar.gz'

Error: Failed to install 'gibbonR' from GitHub:
  System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
  E> The system cannot find the path specified.
E> * checking for file 'C:UsersAvaAppDataLocalTempRtmpYHUJJi
emotes5f8032964d86DenaJGibbon-gibbonR-package-47acbc3/DESCRIPTION' ... OK
E> * preparing 'gibbonR':
  E> * checking DESCRIPTION meta-information ... OK
E> * checking for LF line-endings in source and make files and shell scripts
E> * checking for empty or unneeded directories
E> * building 'gibbonR_0.0.0.9000.tar.gz'
E>

Now, it turns out the package I'm trying to download might not be available for R 4.0.2 (which I only found out by trying:

> pkgbuild::with_build_tools(install.packages("DenaJGibbon/gibbonR-package", type = "source"))
Installing package into ‘C:/Users/Ava/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘DenaJGibbon/gibbonR-package’ is not available (for R version 4.0.2)

But the error persists, since other packages that are available for 4.0 throw the same error:

devtools::install_github('hadley/ggplot2')
Downloading GitHub repo hadley/ggplot2@HEAD
The system cannot find the path specified.
√  checking for file 'C:UsersAvaAppDataLocalTempRtmpQbOqhX
emotes11d86e2e12eeidyverse-ggplot2-dbd7d79/DESCRIPTION' ...
-  preparing 'ggplot2': (1.7s)
√  checking DESCRIPTION meta-information ...
-  checking for LF line-endings in source and make files and shell scripts (952ms)
-  checking for empty or unneeded directories
-  building 'ggplot2_3.3.3.9000.tar.gz'

Error: Failed to install 'ggplot2' from GitHub:
  System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
  E> The system cannot find the path specified.
E> * checking for file 'C:UsersAvaAppDataLocalTempRtmpQbOqhX
emotes11d86e2e12eeidyverse-ggplot2-dbd7d79/DESCRIPTION' ... OK
E> * preparing 'ggplot2':
  E> * checking DESCRIPTION meta-information ... OK
E> * checking for LF line-endings in source and make files and shell scripts
E> * checking for empty or unneeded directories
E> * building 'ggplot2_3.3.3.9000.tar.gz'
E>

Other attempts:

  • Thinking it might have to do with permissions to access the temporary directory, I tried running this from RStudio opened as admin, but problem persisted.

  • I also tried adding a new temporary directory, and specifying this in both the .Renviron file and a new Renviron.site in C:UsersAvaDocuments (TMPDIR = C: temp). RStudio run as admin still threw same errors.

  • Thinking it may have come from the fact that I had two versions of R installed (3.6 and 4.0), I uninstalled R 3.6, restarted R, but same error when I tried with devtools::install_github("rmcelreath/rethinking").

  • I tried adding the Rcmd.exe file directly to the path, still no luck:

usrin
C:Program FilesRR-4.0.2inx64
C:Program FilesRR-4.0.2inx64
C:Program FilesRR-4.0.2inx64Rcmd.exe
C:
tools40usrin
C:
tools40mingw64in
  • Removed Anaconda from my path, thinking a possible duplicate of R executable might be causing the problem, still no luck.

  • Although my wd() is not in a OneDrive folder, I paused syncing and closed, as previous users has a problem with OneDrive sync messing with R.

Thanks for any tips!

question from:https://stackoverflow.com/questions/66064296/how-to-resolve-install-github-fails-with-error-system-command-rcmd-exe-failed

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...