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

Hi there,

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:\Users\Ava\AppData\Local\Temp\RtmpQbOqhX\remotes11d83d647a58\DenaJGibbon-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:\Users\Ava\AppData\Local\Temp\RtmpQbOqhX\remotes11d83d647a58\DenaJGibbon-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 Files\R\R-4.0.2\bin\x64
C:\Program Files\R\R-4.0.2\bin\x64
C:\rtools40\usr\bin
C:\rtools40\mingw64\bin
  1. For good measure, created an .Renviron file in C:\Users\Ava\Documents, that includes the line PATH=${RTOOLS40_HOME}\usr\bin;${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:\rtools40\mingw64\bin 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 Files\R\R-4.0.2\bin\x64

> 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:\Users\Ava\AppData\Local\Temp\RtmpYHUJJi\remotes5f8032964d86\DenaJGibbon-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:\Users\Ava\AppData\Local\Temp\RtmpYHUJJi\remotes5f8032964d86\DenaJGibbon-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:\Users\Ava\AppData\Local\Temp\RtmpQbOqhX\remotes11d86e2e12ee\tidyverse-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:\Users\Ava\AppData\Local\Temp\RtmpQbOqhX\remotes11d86e2e12ee\tidyverse-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>

Any ideas on how to resolve this?

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

Update 2: Following up, I also tried adding a new temporary directory, and specifying this in both the .Renviron file and a new Renviron.site in C:\Users\Ava\Documents (TMPDIR = C:\rtemp). RStudio run as admin still threw same errors.

Update 3: 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").

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

\usr\bin
C:\Program Files\R\R-4.0.2\bin\x64
C:\Program Files\R\R-4.0.2\bin\x64
C:\Program Files\R\R-4.0.2\bin\x64\Rcmd.exe
C:\rtools40\usr\bin
C:\rtools40\mingw64\bin

Update 5: I remove Anaconda from my path, thinking a possible duplicate of R executable might be causing the problem, still no luck.

Update 6, OneDrive is not causing the problem, as it persists even when not working in a OneDrive folder, sync is paused and OneDrive is closed.

Thanks,

Hello ava, I am having a similar problem. I originally had R version 3.6 and recently upgraded to R version 4.0. I have been getting: Failed to install 'leidenbase' from Github: System command 'Rcmd.exe' failed, exit status:1, stout + stderr empty. Even my install.packages() fails for crayon and dplyr on R Studio. I've tried changing CRAN mirrors, security measure for downloading packages, and still nothing has worked. Hope we can solve this soon.

Update: In my case at least, I have narrowed down that any packages that need to build from a tar.gz (source) fail but not with a .zip (binary). It is able to download the tar.gz and save it to the temporary location, but it fails at the next step. Not sure, if you've found a solution, but I'll let you know if I do.

Update 2: I ended up doing a hard reset of my PC. It was a fairly new laptop, so everything was pretty much backed up. Windows 10 has an option to delete apps, files, and presets, and redownload windows from the cloud. For me, it took less than an hour to reset. I redownloaded R version 4.0.3, Rtools40 (following the adding it to your path with .Renviron), and then R studio 1.4.1103. I was able to upgrade to all new packages, and use devtools to install Monocle3 software without issue. It's definitely a drastic measure and I wouldn't want to do this again, so if you do figure out an alternative to your problem, I'd really love to know! Thank you!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.