简体   繁体   English

在狭窄情况下如何调试R CMD检查失败的情况

[英]How to debug a case where R CMD check fails under narrow circumstances

Apologies for yet another package build debugging, but I'm completely stumped here. 为另一个软件包的构建调试而道歉,但我在这里完全迷住了。

Using R-devel.sh CMD check taRifx.geo_1.0.6.tar.gz --as-cran on (X)Ubuntu 14.04 LTS, installed via this script , I get the following error: 使用R-devel.sh CMD check taRifx.geo_1.0.6.tar.gz --as-cran在通过此脚本安装的(X)Ubuntu 14.04 LTS上R-devel.sh CMD check taRifx.geo_1.0.6.tar.gz --as-cran ,我得到以下错误:

* checking examples ... ERROR
Running examples in ‘taRifx.geo-Ex.R’ failed
The error occurred in:
[ ...SNIP... ]
> ### * </HEADER>
> library('taRifx.geo')
Loading required package: sp
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘lattice’
Error: package ‘sp’ could not be loaded
Execution halted

The manual for package checking says: 软件包检查手册说:

Before using these tools, please check that your package can be installed (which checked it can be loaded). 在使用这些工具之前,请检查您的软件包是否可以安装(检查是否可以加载)。 R CMD check will inter alia do this, but you may get more detailed error messages doing the install directly. R CMD检查尤其可以做到这一点,但是您可能会在直接安装时得到更详细的错误消息。

But when I do that (being sure to use R-devel, loaded with --vanilla ), I get no error: 但是,当我这样做时(确保使用R-devel并加载了--vanilla ),我不会出错:

# 1) 
install.packages("taRifx.geo_1.0.6.tar.gz",repos=NULL)
# 2) 
library(taRifx.geo)
# 3) Profit.

If I run R CMD check through RStudio or command line R (but not the -devel version), I also get no error. 如果我通过RStudio或命令行R(而不是-devel版本)运行R CMD check ,我也不会收到任何错误。

Thing is, when I search the entire project's code for "lattice", I can't find any case where I use it, even in the example files. 问题是,当我在整个项目的代码中搜索“ lattice”时,即使在示例文件中也找不到使用它的情况。 lattice is installed and I've tried checking with lattice in Suggests and without. lattice安装和我已经与晶格中尝试检查Suggests并没有。

Project code here: https://github.com/gsk3/taRifx.geo 项目代码在这里: https : //github.com/gsk3/taRifx.geo

The check logs are here . 检查日志在这里

Now for the question: How do I go about debugging this? 现在是一个问题:我该如何调试它? I have some thoughts as to where the problem might lie (Depends rather than Imports for a few packages, and the spatial packages tend to have very intertangled namespaces), but I can't really begin to solve it unless I can reproduce the error in an environment other than R CMD check run from the command line via R-devel.sh . 我对问题可能出在哪里有一些想法(一些包依赖于而不是Imports,而空间包往往具有非常纠结的名称空间),但是除非能够在其中重现错误,否则我无法真正开始解决它。通过R-devel.sh从命令行运行R CMD check以外的环境。

This, by the way, is Under development (unstable) (2014-05-26 r65771) -- "Unsuffered Consequences" . 顺便说一句,这Under development (unstable) (2014-05-26 r65771) -- "Unsuffered Consequences" Appropriately named. 适当命名。

Edit 编辑

Here are the contents of /usr/local/lib/R/site-library : 这是/usr/local/lib/R/site-library

akima       digest      labeling  plyr          RJSONIO      stringr
bitops      evaluate    lattice   proto         R.methodsS3  survival
boot        fields      mapproj   pspline       R.oo         taRifx
caTools     functional  maps      RandomFields  RSQLite      taRifx.geo
cluster     gdata       maptools  RColorBrewer  R.utils      testthat
colorspace  geoR        MASS      Rcpp          scales       whisker
data.table  ggplot2     Matrix    RCurl         shapefiles   xtable
DBI         gtable      memoise   reshape2      sp
devtools    gtools      munsell   rgdal         spam
dichromat   httr        nlme      rgeos         splancs

The lattice description file says: lattice描述文件说:

Depends: R (>= 2.15.1)
Built: R 3.2.0; x86_64-unknown-linux-gnu; 2014-05-29 17:14:03 UTC; unix

Still the same error on the CMD check . CMD check仍然存在相同的错误。

I had been attempting to install to the site-wide library at "/usr/local/lib/R/site-library" which did not solve it, but I instead brute-forced a solution. 我一直试图在"/usr/local/lib/R/site-library"上安装到站点范围的库,该"/usr/local/lib/R/site-library"不能解决问题,但是我蛮力地提出了一个解决方案。

First, find all the places R might look: 首先,找到R可能看起来的所有位置:

> .libPaths()
[1] "/usr/local/lib/R/site-library"       
[2] "/usr/lib/R/site-library"             
[3] "/usr/lib/R/library"                  
[4] "/usr/local/lib/R-devel/lib/R/library"

Then, as root, install to each of those in turn until the error goes away. 然后,以root用户身份依次安装到每个驱动程序,直到错误消失。 As it turns out, it's "/usr/local/lib/R-devel/lib/R/library" : 事实证明,它是"/usr/local/lib/R-devel/lib/R/library"

install.packages(c('lattice','sp'),lib="/usr/local/lib/R-devel/lib/R/library")

Then q() that R-devel session and run R-devel.sh CMD check mypackage.tar.gz --as-cran . 然后q()那个R-devel会话并运行R-devel.sh CMD check mypackage.tar.gz --as-cran

As for why it needs lattice in the first place, I suspect it's pulling in an .Rdata file at launch which has lattice in the namespace. 至于为什么首先需要lattice ,我怀疑它在启动时会拉入.Rdata文件,该文件在名称空间中具有lattice

Many thanks to @DirkEddelbuettel and @GavinSimpson for the various shoves in the right direction. 非常感谢@DirkEddelbuettel和@GavinSimpson朝着正确的方向前进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM