【问题标题】:Installing R package ERROR: installing binary package failed安装 R 包错误:安装二进制包失败
【发布时间】:2019-07-09 18:30:10
【问题描述】:

这里完全是新手,所以这里可能有一些非常糟糕的地方。我按照 Hadley Wickham 关于 R 包的书创建了一个项目,现在我正在尝试将其添加到 github 以进行远程安装 (repository for reference)。

运行devtools::install_github("alutterb/abcmlr") 生成以下输出:

Downloading GitHub repo alutterb/abcmlr@master
√  checking for file 'C:\Users\amlut\AppData\Local\Temp\RtmpMpn5uJ\remotes7146c405dd7\alutterb-abcmlr-918bf05/DESCRIPTION' ...
-  preparing 'abcmlr':
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'abcmlr_0.1.0.tar.gz'

Installing package into ‘C:/Users/amlut/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *binary* package 'abcmlr' ...
cp: unknown option -- )
Try '/Rtools/bin/cp --help' for more information.
ERROR: installing binary package failed
* removing 'C:/Users/amlut/Documents/R/win-library/3.5/abcmlr'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/amlut/AppData/Local/Temp/RtmpMpn5uJ/file71463953e7b/abcmlr_0.1.0.tar.gz’ had non-zero exit status

在我的存储库中,我有一个与wsl 一起使用的Linux 可执行文件,以及一个在我的R 代码中调用的.exe 文件。这些可能是罪魁祸首,但我并不完全确定。该错误指出它无法安装二进制包,但install_github() 需要一个源包,所以我不确定发生了什么。任何帮助表示赞赏。

谢谢。

编辑:这个问题解决了。这是因为我的DESCRIPTION 文件中有一行与Built 有关。

【问题讨论】:

    标签: r github


    【解决方案1】:

    检查您的%PATH% 并输入:where cp。

    另一个cp(就像来自 Git for Windows 发行版的一个)可能会使 RTools cp 黯然失色,这可能会解释错误消息。


    作为OP hkj447的commented,错误是由DESCRIPTION文件中的一行触发的:

    Built: R 3.5.3; ; 2019-06-14 21:17:43 UTC; windows
    

    如见in this thread:

    您的包的DESCRIPTION 文件中有一个名为“Built:”的字段;
    R 通常会在从源代码构建您的包时尝试注入该字段本身。

    我删除了DESCRIPTION中“Built”的行,然后重新安装。
    这次没有出现错误。

    【讨论】:

    • @hkj447 您在哪个版本的 Windows 上启动该进程?在什么外壳(WSL、DOS、Powershell)中?安装了什么 Git for Windows? 2.22?用什么%PATH%?
    • 我确实想通了。这是我的DESCRIPTION 文件中的一行。
    • 你知道哪一行吗?
    • Built: R 3.5.3; ; 2019-06-14 21:17:43 UTC; windows
    • @hkj447 好的。我已经相应地编辑并记录了答案。
    猜你喜欢
    • 2021-12-16
    • 2019-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-08
    • 2014-06-01
    • 2021-12-15
    • 1970-01-01
    相关资源
    最近更新 更多