[英]“API rate limit exceeded” when trying to install local R package using devtools::install()
Package development beginner here! 包开发初学者在这里!
I'm trying to turn some code into a local R package for the very first time. 我正在尝试第一次将一些代码转换为本地R包。 I made a package using
usethis::create_package()
, added documentation using devtools::document()
. 我使用
usethis::create_package()
制作了一个包,并使用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()
: 现在,在玩了一段时间之后,尝试使用
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")
. 如果我使用
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. 真正令我困惑的是,我试图通过安装位于本地文件夹中的软件包来达到GitHub速率限制。
Did I make a mistake in the package setup, or does using devtools::install()
always involve the GitHub API? 我在软件包设置中是否犯了错误,还是使用
devtools::install()
始终涉及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: 编辑:我的DESCRIPTION文件引用了其他软件包:
Depends:
R (>= 3.4.3),
dplyr
Imports:
RMariaDB,
dbplyr,
DBI,
reshape2,
RColorBrewer,
knitr,
kableExtra,
scales,
magrittr,
DT,
formattable,
testthat,
ggplot2,
rmarkdown
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 ). 这似乎在默认情况下,
devtools::install()
对列为下依赖的所有包检查Depends
, Imports
和LinkingTo
在DESCRIPTION
文件中(参见解释dependencies = NA
在devtools选项参考手册这里 )。 This is also true for remotes::install_local()
, which devtools::install_local()
links to. devtools::install_local()
链接到的remotes::install_local()
也是如此。
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
. 一种解决方案是显式禁用检查程序包依赖关系:如果改用
devtools::install("my_local_package", dependencies = FALSE)
,则不再需要连接到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!) (同样值得注意的是:
devtools::install()
的默认选项需要互联网连接才能安装任何软件包,但是通过设置dependencies = FALSE
,还可以离线安装本地软件包!)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.