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
A rate limit is the number of API calls an app or user can make within a given time period. If this limit is exceeded or if CPU or total time limits are exceeded, the app or user may be throttled. API requests made by a throttled user or app will fail.
API rate limit exceeded for 206.214.41.90. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
install_github results in an api rate limit error regardless of which package is installed. Here is the error: WARNING: Rtools is required to build R packages, but is not currently installed.
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.
The current CRAN version of devtools uses a raw.githubusercontent.com link for the name and a call to git2r::remote_ls () for the SHA, both of which do not use the GitHub API. remotes uses the API to retrieve both pieces of information. The benefits to using the API is that it works seamlessly for GitHub enterprise as well as private repositories.
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!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With