导入的软件包不会自动安装 [英] Imported packages do not auto-install

查看:93
本文介绍了导入的软件包不会自动安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地存储的私有软件包(并通过SVN控制版本)。要安装软件包,我要求用户SVN更新他/她的软件包目录,然后在目录上 setwd(),然后 devtools :: install()

I have a private package stored locally (and version-controlled via SVN). To install the package, I am asking the user to SVN-update his/her package directory, then setwd() on the directory, and then devtools::install().

此程序包导入了许多CRAN程序包,这些程序包不在本地存储。这些导入的软件包不会在安装过程中自动安装,这会产生错误消息依赖软件包foo不可用。用户必须手动安装 install.packages('foo'),然后重试,只是获得依赖包栏不可用,广告恶心,即使 foo bar 都在我的进口商品中:

This package imports many CRAN packages, which are not stored locally. These imported packages are not auto-installing during the installation, which produces the error message Dependency package foo not available. The user must manually install install.packages('foo'), then try again, only to get Dependency package bar not available, ad nauseam, even though foo and bar are among my Imports:

详细信息:

我的Description文件如下:

My DESCRIPTION file looks like:

Package: apackage
Type: Package
Title: Package to Do Stuff
Version: 1.11111
Date: 2017-03-02
Author: C8H10N4O2
Maintainer: C8H10N4O2<C8H10N4O2@example.com>
Description: Package that does many useful things
License: file LICENSE
Depends:
    R (>= 3.3.0)
Imports:
    bit64 (>= 0.9.5),
    data.table (>= 1.9.6), 
    extrafont (>= 0.17),
    foreach(>= 1.4.3),
    ggplot2 (>= 2.0.0),
    gbm (>= 2.1),
    grid (>= 3.2.3),
    gridExtra (>= 2.0.0),
    httr (>= 1.1.0),
    readxl (>= 0.1.1),
    scales (>= 0.4.0),
    xlsx (>= 0.5.7)
LazyData: true
RoxygenNote: 5.0.1
Suggests: testthat (>= 0.9.1)

但是调用 check() load_all()我仍然会收到错误:

But upon invoking check() or load_all() I still get the error:

Error in (function (dep_name, dep_ver = NA, dep_compare = NA)  : 
  Dependency package gridExtra not available.

然后我的用户必须 install.packages('gridExtra'),然后他(她)获得了另一个依赖可用错误。

And then my user has to install.packages('gridExtra'), and then he/she gets another dependency not available error.

我尝试过的事情:

根据 R包


导入:必须列出此处列出的软件包,您的软件包才能进行
工作。实际上,无论何时安装软件包,只要
软件包(如果尚不存在)
,都将它们安装在计算机
上(devtools :: load_all()还会检查

Imports: packages listed here must be present for your package to work. In fact, any time your package is installed, those packages will, if not already present, be installed on your computer (devtools::load_all() also checks that the packages are installed).

我还检查了编写R扩展,但在该主题上找不到其他内容。

I also checked Writing R Extensions but couldn't find anything else on this topic.

我是否认为这些软件包应该是自动安装的,我应该怎么做才能确保它们自动安装?

Am I correct that these packages should be auto-installing, and what should I do to ensure that they auto-install?

我认识到该问题并非完全可以重现,但是我无法链接到我的仓库,因此我很乐意提供其他详细信息。

I recognize that the problem is not fully reproducible, but I can't link to my repo, so I'm happy to provide any additional details.

**versions**
R 3.4.0, platform = x86_64-w64-mingw32
devtools 1.13.1


推荐答案

您正在使用R重新包装,我建议不要这样做。您可以 drat 创建存储库。这是真正的可行尝试过的。

You are reinventing packaging with R. I advise against. You could just drat to create a repository. This is tried and true and works.

这是部署方面,用于本地包的生产以及它们的使用和安装与您保存源的位置完全正交。不要将源代码存储库误认为是代码分发机制。

And this deployment aspect, for both production of local packages as well as their use and installation is entirely orthogonal to where you keep sources. Don't mistake a source code repository for code distribution mechanism.

总而言之,请使用 drat 以及本地GitHub Enterprise实例在我们的工作中如虎添翼,并且 drat 用途相当广泛。

In sum, using drat locally along with local GitHub Enterprise instance has worked swimmingly for us at work, and drat in general is in fairly widespread use.

(通常免责声明,因为我是开始 drat ,但我也有很多贡献者。)

(Usual disclaimers as I am the one who started drat, but I had the good fortune of a bunch of contributors too.)

这篇关于导入的软件包不会自动安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆