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

devtools::install_github() success but remotes::install_git() fails #780

Open
mabuimo opened this issue Feb 2, 2024 · 4 comments
Open

Comments

@mabuimo
Copy link

mabuimo commented Feb 2, 2024

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")

  1. 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)```
@gaborcsardi
Copy link
Member

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.

@mabuimo
Copy link
Author

mabuimo commented Feb 5, 2024

Hi @gaborcsardi could you elaborate further about what are the core differences between remotes::install_git() and devtools::install_github, please?

@gaborcsardi
Copy link
Member

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.

@conig
Copy link

conig commented Jun 11, 2024

install_git should take a URL, not a username/repo pair:
Try

remotes::install_git("https://github.com/hrbrmstr/streamgraph.git")

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

3 participants