-
Notifications
You must be signed in to change notification settings - Fork 154
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
Can't install private bitbucket repos #255
Comments
This works for me: remotes::install_bitbucket("gaborcsardi/keyring", password="<app password here>") The app password does not need full privileges at all, I only had "read repo", and apparently that is enough. |
Hmm, I created a private repo and invited you to have read access: https://bitbucket.org/trinker/testprivate Does it work for you to install this? |
No, that does not work, unfortunately. I am not sure why, but seems like in this case BitBucket wants a proper Basic Auth in this case. Unfortunately base R cannot send an HTTP header. We'll fix this, but that will need the curl package. |
BitBucket does not support Basic Auth via URL encoding, apparently. So we use HTTP headers instead. This is somewhat tricky, because base R download.file()) does not allow that directly. We need to shadow an internal function in utils, and also make use of a bugs in curl and the internal download methods, that let you specify multiple HTTP headers via the User-Agent option. This will also fix #255.
@gaborcsardi Thank you for taking a look and getting a fix so quick. This works on my end now. |
BitBucket does not support Basic Auth via URL encoding, apparently. So we use HTTP headers instead. This is somewhat tricky, because base R download.file()) does not allow that directly. We need to shadow an internal function in utils, and also make use of a bugs in curl and the internal download methods, that let you specify multiple HTTP headers via the User-Agent option. This will also fix #255.
One hiccup...from the command line I was fine because:
But in RStudio I am not because:
I think this may because RStudio is setting the following as the default option:
Maybe because I have an outdated RStudio? |
@trinker maybe you can set that to libcurl in your profile, and then RStudio will not override it? |
Yes definitely. But not sure if RStudio should even be setting this. |
Yeah, I agree, ideally it should not. I guess they did it, because the default causes (different) problems to many people. In particular, "wininet" uses windows's proxy config automatically. I think recent R versions select wininet automatically, anyway, but people might be using older ones. Still, maybe "libcurl" is a better default nowadays, all the RStudio packages use the curl package anyway, and this requires the same proxy config as base's libcurl. I'll open an issue or talk to the RStudio IDE folks. |
Yeah, for the IDE the problem is the proxies. If the default method is libcurl, then the proxy settings are not used on a new R installation, and you can't even use I'll try to submit a patch to R, that allows custom headers in |
A patch in R to do this would be awesome |
@jimhester it is quite easy, now that I looked up the details. libcurl and wininet are easy, internal is probably easy as well, and I think we can safely ignore the curl, wget, etc. methods, because there you can already pass headers with extra options, and they should have never existed anyway. |
Unfortunately, setting |
@trinker that is bad, unfortunately. We can work around it in remotes. |
So, I just tried to do
in |
@trinker what is your RStudio version? |
@gaborcsardi I was incorrect. That worked to put it in the .Rprofile in that location. |
OK, that's better. I think I'll just document it that for basic auth you'll need to select the libcurl method (and set proxies), on Windows, in RStudio. |
@jimhester I think we might still want to use the old, header-less method for GH, though, because it works, and the new method does not work with the RStudio default "wininet" download method. Or, even better, we could just try the header-less method for GH, if "wininet" is selected via the option. I'll leave this issue open until this is fixed. |
Actually, it seems that the GH token is still used in the URL, so that's good then, forget it. Also, this issue is already closed... :) |
OK, added a note to the doc: 2e3bf35 |
Hello! I had the same problem. As this was very recent, I didn’t find this fix on 2.0.2 (last release), so I installed the github version (2.0.2.9000) and confirmed that this change was there on NEWS.md: remotes dev
After this, I tried to install my private repository as I have been doing for a long time, but I got the same error. If I used devtools::install_bitbucket version 1.13.5 it worked, but with 2.0.0 or greater, it doesn’t (for devtools and remotes). This is my code
I tried running options(download.file.method = "libcurl") first, but I get the same error. Am I forgetting to do something? |
@rodo-nunez session info and the error message may be helpful here. |
Sorry, the error is:
My session info is > sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Chile.1252 LC_CTYPE=Spanish_Chile.1252
[3] LC_MONETARY=Spanish_Chile.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Chile.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.1 tools_3.4.1 yaml_2.1.19 remotes_2.0.2.9000 |
Hi , I am experiencing the same problem. However, It does work when I set the repo public. Error in utils::download.file(url, path, method = download_method(), quiet = quiet, :
cannot open URL 'https://api.bitbucket.org/2.0/repositories/bitbucketteam/repo/src/master/DESCRIPTION' My session info is > sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C LC_TIME=English_Canada.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] remotes_2.0.2.9000 usethis_1.4.0 devtools_2.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 rstudioapi_0.9.0 magrittr_1.5 pkgload_1.0.2 R6_2.3.0 rlang_0.3.1
[7] tools_3.5.2 pkgbuild_1.0.2 sessioninfo_1.1.1 cli_1.0.1 withr_2.1.2 assertthat_0.2.0
[13] digest_0.6.18 rprojroot_1.3-2 crayon_1.3.4 processx_3.2.1 callr_3.1.1 fs_1.2.6
[19] ps_1.3.0 curl_3.3 memoise_1.1.0 glue_1.3.0 compiler_3.5.2 desc_1.2.0
[25] backports_1.1.3 prettyunits_1.0.2 |
Just hit this, no Windows machine I've tried works. Exact same repo, user, app password works fine on Linux. So just confirming it must be the download method. Doesn't matter if it's R directly or RStudio. Setting the option for libcurl in the session does not seem to work. Any reason the method arg isn't passed down to download.file? Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 ps_1.3.0 prettyunits_1.0.2 rprojroot_1.3-2 digest_0.6.18 crayon_1.3.4 withr_2.1.2 assertthat_0.2.0 R6_2.4.0
[10] backports_1.1.3 magrittr_1.5 rlang_0.3.1 cli_1.0.1 fs_1.2.6 remotes_2.0.2 callr_3.1.1 devtools_2.0.1 desc_1.2.0
[19] tools_3.5.2 glue_1.3.0 pkgload_1.0.2 compiler_3.5.2 processx_3.2.1 pkgbuild_1.0.2 sessioninfo_1.1.1 memoise_1.1.0 usethis_1.4.0 |
Apologies, just tried the version of remotes in github and it does work if I change the options. However the new code does not pick libcurl even though it detected it (has_curl returns true, but download_method still uses winnet), and I had to force it by setting the options. |
A little more investigating, the download.file method has a default set and it's wininet.
So this line in download_method() always has a value, and it always gets used even if it isn't good: I think a better solution for now is to take the method args ... expansion. The docs say
but that clearly isn't true, I think it would be more obvious than setting the session options. |
Hi all, I am having the same issue. I have set the download option to libcurl:
And this still happens:
Same command works on linux. Any help is much appreciated! Session info is as follows:
|
@jakegalson did you upgrade remotes from github 1st? the CRAN version won't work with the override currently. |
I have the same error. I am trying to run the initial script for RemixAutoML in step 1 https://github.com/AdrianAntico/RemixAutoML > sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] usethis_1.5.0 devtools_2.0.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 ps_1.3.0 prettyunits_1.0.2 rprojroot_1.3-2
[5] withr_2.1.2 digest_0.6.19 crayon_1.3.4 assertthat_0.2.1
[9] R6_2.4.0 backports_1.1.4 magrittr_1.5 rlang_0.3.4
[13] cli_1.1.0 curl_3.3 fs_1.3.1 remotes_2.0.4
[17] rstudioapi_0.10 callr_3.2.0 desc_1.2.0 tools_3.5.3
[21] glue_1.3.1 pkgload_1.0.2 compiler_3.5.3 processx_3.3.1
[25] pkgbuild_1.0.3 sessioninfo_1.1.1 memoise_1.1.0
> remotes:::has_curl()
[1] TRUE
> remotes:::download_method()
[1] "libcurl"
> getOption("download.file.method")
[1] "libcurl"
> for (i in to_install) {
+ message(paste("looking for ", i))
+ if(i == "catboost" & !requireNamespace(i)) {
+ devtools::install_github('catbo .... [TRUNCATED]
looking for catboost
Loading required namespace: catboost
Failed with error: ‘there is no package called ‘catboost’’
Downloading GitHub repo catboost/catboost@master
Error in utils::download.file(url, path, method = download_method(), quiet = quiet, :
cannot open URL 'https://api.github.com/repos/catboost/catboost/tarball/master' |
I have used
devtools::install_bitbucket
to install private repos for my company for 3 years. Within the last 2 months the same code I used to use to install private repos no longger works. I can install public repos (so if I make the repo below that is private a public repo and then runremotes::install_bitbucket('trinker/cltext')
eveything runs.In reading the documentation I saw that it is likely that I need to set up an App Password. I set one up and copied it. I also saw that maybe I need to use the email rather than username in Googleing this. I tried this combo as well. All result in the same error message:
In the app password I gave the instance full priveleges (checked every box possible).
MWE-ish
Code I'm trying showing all the different ways I've tried to run it. I know this is a private repo so this isn't really a MWE.
Session Info
The text was updated successfully, but these errors were encountered: