问题
Package development beginner here!
I'm trying to turn some code into a local R package for the very first time. I made a package using usethis::create_package()
, added documentation using devtools::document()
.
Now, after playing around with it for a while, I ran into the following error when trying to install the newest version using devtools::install()
:
Error: HTTP error 403.
API rate limit exceeded for [my IP]. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
Rate limit remaining: 0/60
Rate limit reset at: 2019-03-18 16:32:05 UTC
To increase your GitHub API rate limit
- Use `usethis::browse_github_pat()` to create a Personal Access Token.
- Use `usethis::edit_r_environ()` and add the token as `GITHUB_PAT`.
The problem still exists if I use devtools:install_local("my_folder_name")
. What genuinely confuses me here is that I am hitting a GitHub rate limit by trying to install a package sitting in a local folder.
Did I make a mistake in the package setup, or does using devtools::install()
always involve the GitHub API?
Is there anything I can change to keep the installation process of my package local and thus avoid the rate limit issue?
Edit: My DESCRIPTION file refers to other packages:
Depends:
R (>= 3.4.3),
dplyr
Imports:
RMariaDB,
dbplyr,
DBI,
reshape2,
RColorBrewer,
knitr,
kableExtra,
scales,
magrittr,
DT,
formattable,
testthat,
ggplot2,
rmarkdown
回答1:
It seems that by default, devtools::install()
checks for all packages listed as dependencies under Depends
, Imports
and LinkingTo
in the DESCRIPTION
file (see explanation of dependencies = NA
option in devtools reference manual here). This is also true for remotes::install_local()
, which devtools::install_local()
links to.
A solution to this is to explicitly disable checking package dependencies: If you use devtools::install("my_local_package", dependencies = FALSE)
instead, you no longer need to connect to api.github.com
. Doing this makes sense when you know you already have the necessary dependencies installed, which is the case when you're R-packaging your own code.
(Also worth noting: The default options in devtools::install()
require an internet connection for installation of any packages but by setting dependencies = FALSE
, it's also possible to install a local package offline!)
来源:https://stackoverflow.com/questions/55225847/api-rate-limit-exceeded-when-trying-to-install-local-r-package-using-devtools