13

I am developing two packages on GitHub and I am trying to install them using the devtools::install_github() command.

Since the repositories are private, I created a auth_token for my account (as far as I see, there is no way to do this for a single repo?)

devtools::install_github("mariodejung/rMQanalysis", 
                         auth_token="6cd2dbe8bd1f062842b90afXXXXXXXXXXXXXXXXX", 
                         ref="develop", 
                         dependencies=TRUE)
devtools::install_github("mariodejung/cfpscripts", 
                         auth_token="6cd2dbe8bd1f062842b90afXXXXXXXXXXXXXXXXX", 
                         ref="develop")

The installation of the first package works as expected, the second one starts installing but stops with an error and for any reason it mentioned the first already installed package. See the error in the comment at the end. I don't know why this happens and how to resolve it.

I added the error message below again since I changed some things already.

Sorry for changing the auth_token but the script should stay private for now.

I checked also to install both packages with just one command but it leads to the same error message. I also added the GITHUB_PAT variable in my environment as suggested from the comments, to not use the auth token publicly.

devtools::install_github(c("mariodejung/rMQanalysis","mariodejung/cfpscripts"), 
                         ref="develop", 
                         dependencies=TRUE)

This command now installs the rMQanalysis package successfully and fails with the same error message while installing cfpscripts. Still no idea how to figure out what the problem is. It works on other machines. Also all dependencies are installed.

devtools::install_github(c("mariodejung/rMQanalysis","mariodejung/cfpscripts"), ref='develop', quiet=FALSE)
Using GitHub PAT from envvar GITHUB_PAT
Downloading GitHub repo mariodejung/rMQanalysis@develop
from URL https://api.github.com/repos/mariodejung/rMQanalysis/zipball/develop
Installing rMQanalysis
"C:/PROGRA~1/R/R-32~1.5/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/cfproteomics/AppData/Local/Temp/RtmpktvmUK/devtools43850da641a/mariodejung-rMQanalysis-0e38dd3463ea830b19f0afa2ade6f2e14db93041"  \
  --library="C:/Users/cfproteomics/Documents/R/win-library/3.2" --install-tests 

* installing *source* package 'rMQanalysis' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** tests
** preparing package for lazy loading
** help
No man pages found in package  'rMQanalysis' 
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (rMQanalysis)
Downloading GitHub repo mariodejung/cfpscripts@develop
from URL https://api.github.com/repos/mariodejung/cfpscripts/zipball/develop
Installing cfpscripts
Downloading GitHub repo mariodejung/rMQanalysis@develop
from URL https://api.github.com/repos/mariodejung/rMQanalysis/zipball/develop
Error in stop(github_error(request)) : Not Found (404)

I also used the traceback() function but it doesn't give more insights...

15: stop(github_error(request))
14: download_github(dest, src, auth)
13: remote_download.github_remote(remote, quiet = quiet)
12: remote_download(remote, quiet = quiet)
11: FUN(X[[i]], ...)
10: vapply(remotes, install_remote, ..., FUN.VALUE = logical(1))
9: install_remotes(object$remote[behind], ..., quiet = quiet)
8: update.package_deps(pkg, ..., Ncpus = threads, quiet = quiet, 
       upgrade = upgrade)
7: update(pkg, ..., Ncpus = threads, quiet = quiet, upgrade = upgrade)
6: install_deps(pkg, dependencies = initial_deps, upgrade = upgrade_dependencies, 
       threads = threads, force_deps = force_deps, quiet = quiet, 
       ...)
5: install(source, ..., quiet = quiet, metadata = metadata)
4: FUN(X[[i]], ...)
3: vapply(remotes, install_remote, ..., FUN.VALUE = logical(1))
2: install_remotes(remotes, quiet = quiet, ...)
1: devtools::install_github(c("mariodejung/rMQanalysis", "mariodejung/cfpscripts"), 
       ref = "develop", quiet = FALSE)

UPDATE2

The whole problem seems to be a bug in devtools 1.12.0. It works fine in 1.11.1.
I figured out, that my rMQanalysis package is mentioned in cfpscripts as Imports:. If I remove this Imports: statement from the Description, the package installs fine.
I am still wondering, why I can not set dependencies=FALSE to prevent install_github installing the dependent packages.

I filled already a bug report on devtools but no reaction yet.

drmariod
  • 11,106
  • 16
  • 64
  • 110
  • 6
    You should really store your GitHub auth token in `GITHUB_PAT` in `~/.Renviron` (you'll need to restart R so it loads the data in `.Renviron` into your environment). It'll save a great deal of typing/time in the future, help prevent exposure and it may help resolve this issue. – hrbrmstr Sep 23 '16 at 11:33
  • Thanks for the hint with the `GITHUB_PAT`, didn't know that. But it doesn't solve the problem. Still get the same error but with the comment "Using GitHub PAT from envvar GITHUB_PAT". – drmariod Sep 26 '16 at 06:47
  • @ drmariod I'm wondering if this is related to the "testing if installed package can be loaded". Can you run first installation script, then restart r session, run 2nd installation? My hypothesis is that the first package got loaded but not unloaded cleanly, which make the 2nd package installation attempt of install 1st package fail. – dracodoc Sep 30 '16 at 22:19
  • In 2021: This issue was resolved for me by using the `GITHUB_PAT` approach suggested by @hrbrmstr . Note that the `remotes` package also supports explicitly stating github dependencies via the `Remotes:` field in DESCRIPTION. See [here](https://remotes.r-lib.org/articles/dependencies.html). – Niels Feb 22 '21 at 16:13

2 Answers2

3

Have you tried downloading or cloning the repository[since you have paid] and installing from source?

install.packages("/Path/to/source", repos=NULL, type="source")
1

There are some bugs related to the installation from private GitHub repository in the latest devtools version. I've raised an issue and made a PR. You may find the reasons for this problems.

Daeyoung Kim
  • 126
  • 6
  • Hm, your report looks much nicer than mine, maybe yours got attention :-) I downgraded to `devtools 1.11.1` and it is working since then... I am waiting for the new release of `devtools` – drmariod Nov 01 '16 at 09:37