Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_github fails with System command Rcmd.exe failure (rtools properly installed) #2315

Closed
avakiai opened this issue Feb 4, 2021 · 12 comments

Comments

@avakiai
Copy link

avakiai commented Feb 4, 2021

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.

Thanks,

@jimhester
Copy link
Member

jimhester commented Feb 5, 2021

This sort of question is a better fit for https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer)

This issue tracker is for bugs in the devtools code itself, not for general configuration help. The community sites are much better avenues for that.

@avakiai
Copy link
Author

avakiai commented Feb 5, 2021

If anyone who sees this has a potential solution, I've posted this to RStudio Community here.

@haiyonghe
Copy link

Hi @avakiai
Hello, I also encountered this problem, have you solved this bug, sincerely waiting for your reply

@avakiai
Copy link
Author

avakiai commented Aug 13, 2021 via email

@joelostblom
Copy link

I also run into this issue and the thread on the R forum is closed and does not accept replies anymore. If any of you found a solution that does not involve reinstalling your entire OS, please let me know.

@avakiai
Copy link
Author

avakiai commented Oct 1, 2021 via email

@SaJaToGu
Copy link

SaJaToGu commented Nov 3, 2021

Hi there
I have the same issue.
After deinstallation of RStudio by admin and reinstallation of it by my local user by the *.tgz file I run into this problem.
I can not reset my system ;-)
and have no admin authorization.
Any suggestions?
Best,
Guido

@avakiai
Copy link
Author

avakiai commented Nov 3, 2021 via email

@zerihunw
Copy link

I am unable to instill R packages using GitHub

@naddsch
Copy link

naddsch commented Oct 26, 2023

Just in case anyone is having the same problem and is stumbling across this thread:

I came across this thread because I had the exact same problem. Installation from github was not possible, no matter what I tried, I had the "System command 'Rcmd.exe' failed" Error.

I finally found the solution here: https://copyprogramming.com/howto/problem-with-rcmd-exe-when-installing-packages

After removing (or renaming at first for safety reasons) the registry key

\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\AutoRun

the installation via devtools and github is finally working again!

I have struggled with this problem for so long. Hopefully this post can help someone coming across this thread in the future

@e-kotov
Copy link

e-kotov commented Aug 23, 2024

After removing (or renaming at first for safety reasons) the registry key

\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\AutoRun

I don't have such key, but I have the problem with the Rcmd.exe failure. Windows is ridiculous 😠 In my case the issue only occurs with build_vignettes = FALSE.

@e-kotov
Copy link

e-kotov commented Aug 23, 2024

When install_github() fails, especially with build vignettes TRUE , this magically works:

Sys.setenv(PKG_BUILD_VIGNETTES=TRUE)
pak::pkg_install("some/github-package")

Ref: r-lib/pak#71 (comment)
Thanks to @gaborcsardi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants