【问题标题】:`isoband` package installation fails, `testthat.h` not found`isoband` 包安装失败,`testthat.h` 未找到
【发布时间】:2020-07-28 01:50:09
【问题描述】:

我在Ubuntu 18.04.4 LTS 上安装了R (version 3.6.3 (2020-02-29), Holding the Windsock)。当我尝试从源代码安装ggplot2 时,依赖包isoband 的安装失败,找不到testthat.h。完整输出:

> install.packages("ggplot2")
Installing package into ‘/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependency ‘isoband’

trying URL 'https://cloud.r-project.org/src/contrib/isoband_0.2.1.tar.gz'
Content type 'application/x-gzip' length 2293333 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

trying URL 'https://cloud.r-project.org/src/contrib/ggplot2_3.3.0.tar.gz'
Content type 'application/x-gzip' length 3031461 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

* installing *source* package ‘isoband’ ...
** package ‘isoband’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG
    -I"/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include"
    -I"/usr/local/lib/R/site-library/testthat/include"   -fpic  -g -O2
    -fdebug-prefix-map=/build/r-base-V28x5H/r-base-3.6.3=.
    -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
    -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG
    -I"/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include"
    -I"/usr/local/lib/R/site-library/testthat/include"   -fpic  -g -O2
    -fdebug-prefix-map=/build/r-base-V28x5H/r-base-3.6.3=.
    -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
    -D_FORTIFY_SOURCE=2 -g  -c clip-lines.cpp -o clip-lines.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG
    -I"/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include"
    -I"/usr/local/lib/R/site-library/testthat/include"   -fpic  -g -O2
    -fdebug-prefix-map=/build/r-base-V28x5H/r-base-3.6.3=.
    -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
    -D_FORTIFY_SOURCE=2 -g  -c isoband.cpp -o isoband.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG
    -I"/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include"
    -I"/usr/local/lib/R/site-library/testthat/include"   -fpic  -g -O2
    -fdebug-prefix-map=/build/r-base-V28x5H/r-base-3.6.3=.
    -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
    -D_FORTIFY_SOURCE=2 -g  -c polygon.cpp -o polygon.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG
    -I"/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include"
    -I"/usr/local/lib/R/site-library/testthat/include"   -fpic  -g -O2
    -fdebug-prefix-map=/build/r-base-V28x5H/r-base-3.6.3=.
    -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
    -D_FORTIFY_SOURCE=2 -g  -c separate-polygons.cpp -o separate-polygons.o
separate-polygons.cpp:4:10: fatal error: testthat.h: No such file or directory
 #include <testthat.h>
          ^~~~~~~~~~~~
compilation terminated.
/usr/lib/R/etc/Makeconf:177: recipe for target 'separate-polygons.o' failed
make: *** [separate-polygons.o] Error 1
ERROR: compilation failed for package ‘isoband’
* removing ‘/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/isoband’
Warning in install.packages :
  installation of package ‘isoband’ had non-zero exit status
ERROR: dependency ‘isoband’ is not available for package ‘ggplot2’
* removing ‘/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp5aYRcO/downloaded_packages’

我已经尝试过手动安装testthat,但似乎不适用于R 3.6.3:

> install.packages("testthat")
...
Error: package or namespace load failed for ‘pkgload’:
 .onLoad failed in loadNamespace() for 'pkgload', details:
  call: NULL
  error: package ‘testthat’ was installed by an R version with different internals;
         it needs to be reinstalled for use with this R version
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/pkgload’
Warning in install.packages :
  installation of package ‘pkgload’ had non-zero exit status
ERROR: dependency ‘pkgload’ is not available for package ‘testthat’
* removing ‘/home/oszkar/R/x86_64-pc-linux-gnu-library/3.6/testthat’
Warning in install.packages :
  installation of package ‘testthat’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp5aYRcO/downloaded_packages’

任何想法都将不胜感激。

【问题讨论】:

  • 你必须安装testthat。这是isoband 的建议,但不是必需的。
  • 我忘了提到我已经尝试过。问题已更新。
  • 尝试从 github 安装它?
  • 不,不是来自github,但感谢您的建议,正在尝试。
  • 哦,我错过了 testthat 中的一个“t”。问题已更新。

标签: r ggplot2 installation dependencies package


【解决方案1】:

解决了。问题的原因是经过一系列Ubuntu 和R 升级后,我的系统上仍然存在一些从源代码安装的过时软件包。

首先我打开了一个R 控制台并寻找使用3.6 之前的版本构建的R 包的路径:

> unique(subset(as.data.frame(installed.packages()),
                grepl("^3\\.[^6]", Built))[, "LibPath"])
[1] /usr/local/lib/R/site-library /usr/lib/R/library 

由于无法在这些过时的包上应用remove.packages(),我切换到bash,并列出了所有包路径:

>grep 'Built: R 3.[0-5]' /usr/local/lib/R/site-library/*/DESCRIPTION /usr/lib/R/library/*/
DESCRIPTION

我已删除(仅从/usr/local/lib/R/site-library/ 和/usr/lib/R/library/ 中删除)先前命令输出中的包,现在一切正常。

【讨论】:

    猜你喜欢
    • 2022-07-21
    • 1970-01-01
    • 1970-01-01
    • 2017-06-20
    • 2020-02-19
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    • 2013-05-10
    相关资源
    最近更新 更多