remotes
remotes copied to clipboard
devtools::install_github() success but remotes::install_git() fails
I am coming from here. I have observed an extremely annoying issue in corporate environments (Windows 11):
if you are using options(download.file.method = "auto") there is no chance that you will be able to install a package directly from GitHub,
For instance, devtools::install_github("hrbrmstr/streamgraph will fail
Downloading GitHub repo hrbrmstr/streamgraph@HEAD
Error in utils::download.file(url, path, method = method, quiet = quiet, :
cannot open URL 'https://api.github.com/repos/hrbrmstr/streamgraph/tarball/HEAD'
If you use remotes::install_git("hrbrmstr/streamgraph") you get
remotes::install_git("hrbrmstr/streamgraph")
Error: Failed to install 'unknown package' from Git:
Command failed (128)
In addition: Warning message:
In system(full, intern = TRUE, ignore.stderr = quiet) :
running command '"C:\PROGRA~1\Git\cmd\git.exe" ls-remote hrbrmstr/streamgraph ' had status 128
If now you run options(download.file.method = "wininet")
- remotes::install_git() fails
Error: Failed to install 'unknown package' from Git:
Command failed (128)
In addition: Warning message:
In system(full, intern = TRUE, ignore.stderr = quiet) :
running command '"C:\PROGRA~1\Git\cmd\git.exe" ls-remote hrbrmstr/streamgraph ' had status 128
but....
2. devtools::install_github("hrbrmstr/streamgraph") is successful!!
Downloading GitHub repo hrbrmstr/streamgraph@HEAD
── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file 'C:\Users\ubs008\AppData\Local\Temp\RtmpCctAnf\remotes700458d053\hrbrmstr-streamgraph-76f7173/DESCRIPTION' (1.3s)
─ preparing 'streamgraph': (1s)
✔ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building 'streamgraph_0.9.0.tar.gz'
* installing *source* package 'streamgraph' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (streamgraph)```
Yes, I can see that this is annoying, but what can remotes do to improve this? remotes::install_git() uses command line git, so if that doesn't work, I am not sure what we can do.
Btw. you can also try pak::pkg_install("git::https://..."), which might work better, or worse.
Hi @gaborcsardi could you elaborate further about what are the core differences between remotes::install_git() and devtools::install_github, please?
remotes::install_git() uses command line git, or the git2r package. devtools::install_github() and remotes::install_github() (which is the same, effectively) use the GitHub API through HTTP.
install_git should take a URL, not a username/repo pair: Try
remotes::install_git("https://github.com/hrbrmstr/streamgraph.git")