嗨,我在 R 中从源代码安装软件包时遇到问题。我刚买了一台新的工作机器,我们使用的是 R 的 3.5.3 版本,这显然不是最新的,但它适用于我们现有的报告地方。我暂时可以安装二进制包,但我需要从源代码安装某个包才能访问我需要的功能。
当我拿到笔记本电脑时,我安装了 rtools35,这是该版本 R 的 Rtools 兼容版本。但是,我只是看到他们在将笔记本电脑寄给我之前安装了 rtools40,现在我猜这台机器上有 2 个版本的 Rtools?经过一番挖掘后,我发现这可能会导致一些问题,但我所见过的解决方案都没有为我解决任何问题。
以下是安装了不同版本的 RTools 的 2 个文件夹,据我所知,Rtools 指的是 rtools35(我需要使用的那个)。我还读过,如果您重命名 rtools 或移动它的默认位置(我认为我没有做过这两件事),可能会出现问题。
C:/R工具
C:/rtools40
下面是我尝试在我的家中放入的代码 .Rprofile 以明确说明 R 3.5.3 所需的 rtools 版本的路径,但它不能解决我的问题或允许我从源代码安装包。
Sys.setenv(PATH=paste("C:/Rtools/bin",Sys.getenv("PATH"),sep=";"))
Sys.setenv(BINPREF="C:/Rtools/mingw_$(WIN)/bin/")
还要仔细检查以确保必要的文件在 Rtools\bin 中,并且 Rtools 在我的 PATH 中。
Sys.which(c('make', 'gcc'))
"C:\\Rtools\\bin\\make.exe" "C:\\Rtools\\bin\\gcc.exe"
Sys.getenv('PATH')
"C:/Rtools/bin;C:\\Program Files\\R\\R-3.5.3\\bin\\x64;C:\\Rtools\\bin;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\Gpg4win\\..\\GnuPG\\bin;C:\\Program Files\\RStudio\\bin\\rpostback;C:\\Program Files\\RStudio\\bin\\postback"
仔细检查 R 是否可以找到 Rtools
devtools::find_rtools(T)
Scanning R CMD config CC...
cc_path: C:/Rtools/mingw_64/bin/gcc
install_path: C:/Rtools
Found compatible gcc from R CMD config CC
[1] TRUE
这是我的会话信息
session_info()
setting value
version R version 3.5.3 (2019-03-11)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/Los_Angeles
date 2021-06-22
- Packages -----------------------------------------------------------------------------------------------------------------------------------
package * version date lib source
askpass 1.1 2019-01-13 [1] CRAN (R 3.5.3)
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.5.3)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.5.2)
cachem 1.0.5 2021-05-15 [1] CRAN (R 3.5.3)
callr 3.7.0 2021-04-20 [1] CRAN (R 3.5.3)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 3.5.3)
cli 2.5.0 2021-04-26 [1] CRAN (R 3.5.3)
crayon 1.4.1 2021-02-08 [1] CRAN (R 3.5.3)
curl 4.3.1 2021-04-30 [1] CRAN (R 3.5.3)
DBI 1.1.1 2021-01-15 [1] CRAN (R 3.5.3)
desc 1.3.0 2021-03-05 [1] CRAN (R 3.5.3)
devtools * 2.4.2 2021-06-07 [1] CRAN (R 3.5.3)
dplyr 1.0.6 2021-05-05 [1] CRAN (R 3.5.3)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 3.5.3)
fansi 0.5.0 2021-05-25 [1] CRAN (R 3.5.3)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 3.5.3)
fs 1.5.0 2020-07-31 [1] CRAN (R 3.5.3)
gargle 1.1.0 2021-04-02 [1] CRAN (R 3.5.3)
generics 0.1.0 2020-10-31 [1] CRAN (R 3.5.3)
glue 1.4.2 2020-08-27 [1] CRAN (R 3.5.3)
gmailr 1.0.0 2019-08-23 [1] CRAN (R 3.5.3)
googledrive 1.0.1 2020-05-05 [1] CRAN (R 3.5.3)
googlesheets4 0.3.0 2021-03-04 [1] CRAN (R 3.5.3)
httr 1.4.2 2020-07-20 [1] CRAN (R 3.5.3)
jsonlite 1.7.2 2020-12-09 [1] CRAN (R 3.5.3)
lifecycle 1.0.0 2021-02-15 [1] CRAN (R 3.5.3)
magrittr 2.0.1 2020-11-17 [1] CRAN (R 3.5.3)
memoise 2.0.0 2021-01-26 [1] CRAN (R 3.5.3)
openssl 1.4.4 2021-04-30 [1] CRAN (R 3.5.3)
pillar 1.6.1 2021-05-16 [1] CRAN (R 3.5.3)
pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 3.5.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.5.3)
pkgload 1.2.1 2021-04-06 [1] CRAN (R 3.5.3)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.5.3)
processx 3.5.2 2021-04-30 [1] CRAN (R 3.5.3)
ps 1.6.0 2021-02-28 [1] CRAN (R 3.5.3)
purrr 0.3.4 2020-04-17 [1] CRAN (R 3.5.3)
R6 2.5.0 2020-10-28 [1] CRAN (R 3.5.3)
remotes 2.4.0 2021-06-02 [1] CRAN (R 3.5.3)
rlang 0.4.11 2021-04-30 [1] CRAN (R 3.5.3)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 3.5.3)
rstudioapi 0.13 2020-11-12 [1] CRAN (R 3.5.3)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.3)
testthat 3.0.2 2021-02-14 [1] CRAN (R 3.5.3)
tibble 3.1.2 2021-05-16 [1] CRAN (R 3.5.3)
tidyselect 1.1.1 2021-04-30 [1] CRAN (R 3.5.3)
usethis * 2.0.1 2021-02-10 [1] CRAN (R 3.5.3)
utf8 1.2.1 2021-03-12 [1] CRAN (R 3.5.3)
vctrs 0.3.8 2021-04-29 [1] CRAN (R 3.5.3)
withr 2.4.2 2021-04-18 [1] CRAN (R 3.5.3)
[1] C:/Users/Jacob Yablonski/Documents/R/win-library/3.5
[2] C:/Program Files/R/R-3.5.3/library
这是尝试从源代码安装包的样子。
install.packages('kableExtra', dependencies = TRUE, type = 'source')
* installing *source* package 'kableExtra' ...
** package 'kableExtra' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'kableExtra'
finding HTML links ... done
add_footnote html
add_header_above html
add_indent html
as_image html
auto_index html
cell_spec html
collapse_rows html
column_spec html
footnote html
footnote_marker_number html
graphics_helpers html
group_rows html
header_separate html
html_dependency_bsTable html
html_dependency_kePrint html
html_dependency_lightable html
kableExtra-package html
kableExtra_latex_packages html
kable_as_image html
kable_as_xml html
kable_classic html
kable_styling html
kbl html
Rd warning: C:/Users/Jacob Yablonski/AppData/Local/Temp/Rtmpcl12FV/R.INSTALL18206c232499/kableExtra/man/kbl.Rd:70: file link 'opts_current' in package 'knitr' does not exist and so has been treated as a topic
landscape html
linebreak html
listify_args html
magic_mirror html
make_inline_plot html
reexports html
remove_column html
rmd_format html
row_spec html
save_kable html
scroll_box html
spec_angle html
spec_boxplot html
spec_color html
spec_font_size html
spec_hist html
spec_image html
spec_plot html
spec_pointrange html
spec_popover html
spec_tooltip html
usepackage_latex html
xml_as_kable html
xtable2kable html
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
> Adding '^\\.secret$' to './.Rbuildignore'
Error: Can't get Google credentials.
Are you running gmailr in a non-interactive session? Consider:
* Call `gm_auth()` directly with all necessary specifics.
Execution halted
*** arch - x64
Error: Can't get Google credentials.
Are you running gmailr in a non-interactive session? Consider:
* Call `gm_auth()` directly with all necessary specifics.
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/Jacob/Documents/R/win-library/3.5/kableExtra'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘kableExtra’ had non-zero exit status
我的 .Rprofile 中有一些 google oauth 内容,这是我认为弹出这些 google 警告的唯一原因,但其中仍然很奇怪。我不知道我是否有 rtools 问题,或者这些谷歌警告是否就像完全停止这些软件包安装一样。
下面是从二进制安装包的样子,没有抛出丑陋的警告或错误。
package ‘kableExtra’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Jacob Yablonski\AppData\Local\Temp\Rtmp6FZzqg\downloaded_packages
我不知道我还缺少什么。我应该删除 rtools40 吗?我在某处缺少逗号或反斜杠吗?我需要安装一些 Windows 编译器文件吗?我没有运行 .exe 文件的权限,但在最坏的情况下,我想我可以联系 IT 以重新安装 R&rtools35 并从那里开始。但是,如果有人对如何使其工作有任何想法,以便我可以从源代码安装软件包,我将不胜感激!