Cannot install github packages when using r2u
LukasWallrich opened this issue · comments
Thanks for this action - it is wonderfully fast. However, I cannot get it to install github packages with remotes.
For instance, see this action failure - I get a message regarding the PAT quota limit even though it is a public repository.
Following the error message, I was thinking that I might just need to delete the PAT - but my attempt there does not work either. Obviously I can find a way that works non-interactively, but before investing the time, it would be great to know if I am on the right track ...
Precede any commands where you want default behaviour with bspm::disable()
, ie
bspm::disable()
remotes::install_github("abc/def")
(Also, better to cust and paste text than to post images.)
So I just did
edd@rob:~$ docker run --rm -ti rocker/r2u Rscript -e 'bspm::disable(); remotes::install_github("ESHackathon/CiteSource")'
Untracing function "install.packages" in package "utils"
Downloading GitHub repo ESHackathon/CiteSource@HEAD
.... lines omitted ...
Installing 134 packages: rlang, lifecycle, glue, cli, withr, vctrs, utf8, pkgconfig, pillar, magrittr, fansi, backports, stringi, cpp11, timechange, generics, sys, askpass, R6, openssl, mime, jsonlite, curl, Rcp
p, fastmap, rappdirs, fs, digest, sass, memoise, jquerylib, htmltools, cachem, base64enc, later, promises, tidyselect, tibble, parallelly, listenv, globals, future, SQUAREM, progressr, numDeriv, future.apply, sh
ape, lava, diagram, data.table, prodlim, proxy, bit, plogr, DBI, blob, bit64, SnowballC, tokenizers, stringr, purrr, janeaustenr, dplyr, bslib, commonmark, crayon, sourcetools, fontawesome, xtable, httpuv, tidyr
, plyr, httr, prettyunits, hms, rematch, progress, cellranger, tzdb, vroom, clipr, XML, rentrez, zip, tinytex, colorspace, xfun, highr, evaluate, munsell, labeling, farver, yaml, rmarkdown, knitr, isoband, gtabl
e, crosstalk, lazyeval, RColorBrewer, htmlwidgets, viridisLite, scales, ggplot2, bibtex, lubridate, xml2, stringdist, evd, ipred, ada, e1071, ff, RSQLite, tidytext, shiny, rscopus, readxl, readr, pubmedR, openxl
sx, openalexR, plotly, igraph, ggrepel, forcats, ca, DT, dimensionsR, bibliometrixData, RefManageR, synthesisr, RecordLinkage, bibliometrix
.... lines omitted ...
which is obviously bad. So you want to disentangle install dependencies (I added helper script installDeps.r
in the container) as well installing the package. You clearly want the 134 (!!) dependencies via r2u.
What I would do if I were you (and I work with r2u off git repos a fair bit) is to clone the repo, change into and call installDeps.r .
first. Then install the package. Let me know if that works.
And yes, the "bad credentials" suggests PAT issues or alike. Not a problem cause by r2u or bspm.
Ok, doing that now.
Step One: Clone the repo, mount the directory inside rocker/r2u
container
Step Two: Run installDeps.r
(a wrapper around a helper from remotes
)
Step Three: Run install.r
That is all it takes. With r2u. No tricks.
> library(CiteSource)
> search()
[1] ".GlobalEnv" "package:CiteSource" "package:stats"
[4] "package:graphics" "package:grDevices" "package:datasets"
[7] "package:utils" "package:methods" "Autoloads"
[10] "package:base"
>
I use r2u a lot for CI, for example we also use it for two active repos at work (one is also at CRAN, the other not yet / maybe never) where we run numerous jobs each week. But we base that on r-ci which I find simpler that the r-lib defaults. If things don't work out for you with the r-lib defaults you can maybe ask at their repo for help. The issue is not with r2u itself as demonstrated.
Let me know if I can help otherwise -- now that I have it checked I could toss in an actions yaml file for you as I would write it -- but I consider the issue close for r2u. Feel free to reopen it if you find something amiss at r2u, and preferably show it with a minimally verifiable reproducible example.
You run
run: |
R -e "
install.packages(c('shiny', 'rsconnect'));
if (!require('remotes')) install.packages('remotes');
if (!require('gitcreds')) install.packages('gitcreds');
gitcreds::gitcreds_delete(url = 'https://github.com');
remotes::install_github('ESHackathon/CiteSource');
rsconnect::setAccountInfo(name='${{secrets.SHINY_LUKAS_ACCOUNT}}', token='${{secrets.SHINY_LUKAS_TOKEN}}', secret='${{secrets.SHINY_LUKAS_SECRET}}');
rsconnect::deployApp(appName = 'CiteSource_latest', appDir = './inst/shiny-app/CiteSource')"
but your error is
Error in throw(new_error("gitcreds_not_interactive_error", message = "`gitcreds_delete()` only works in interactive sessions")) :
`gitcreds_delete()` only works in interactive sessions
which is a logical error, no? Anyway in that run you seem to get your packages just fine from r2u.
(I have never used rsconnect
so cannot help there. I have written YAML actions with 'secrets' and 'tokens' to push to other services. Sometimes finicky to setup and debug, but doable. Maybe try to minimize in a trial repo where you store what you want to upload in a zip or tar.gz or rds and focus just on the deploy step? Good luck!
Thanks so much - very helpful @eddelbuettel, and good to understand that bspm::disable()
would resolve the issue as such!
If you don't mind, I would very much appreciate an outline for the YAML that implements your complete solution for installing the package dependencies (or a pointer to a similar example). I know how to checkout the repo in an action, but don't know how to 'mount' it then in that context ...
The deploy part is fine and I can get it to work without r2u ... but given all the dependencies, that takes forever, so that I am very happy that it seems to be possible within r2u.
Sorry 'mount' only applies to using the exiting (outer, on your machine) directory from within Docker.
I'll see about a simple reference YAML setup tomorrow morning.
Thank you so much @eddelbuettel - your YAML was extremely helpful, and the deploy now works.
Even though the PAT issue has nothing to do with r2u, I thought I would post the solution here just in case anyone comes across this - devtools
comes packaged with a PAT that tends to run into rate limits - the simple solution is to specify the automatic PAT in GH Actions by setting
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Ohhhhh I did not know about devtools
shipping its own PAT. That is both helpful (minimizes friction) and silly (of course it get overused) and then, once again, leaves less-experienced users in what is sometimes described as a state of "learned helplessness". Can't win'em all.
Glad you are sorted and that r2u is coming in handy.