首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >`isoband`包安装失败,找不到`testthat.h`

`isoband`包安装失败,找不到`testthat.h`
EN

Stack Overflow用户
提问于 2020-04-15 14:47:06
回答 1查看 550关注 0票数 0

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

代码语言:javascript
复制
> 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

代码语言:javascript
复制
> 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’

任何想法都将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-15 18:08:21

解决了。问题的原因是,在一系列的UbuntuR升级之后,一些从源代码安装的过时的包仍然留在我的系统上。

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

代码语言:javascript
复制
> 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,并列出了所有包路径:

代码语言:javascript
复制
>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/中删除)包,现在一切正常。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61222863

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档