Сбой установки пакета `isoband`,` testthat.h` не найден - PullRequest
0 голосов
/ 15 апреля 2020

У меня установлена ​​R (version 3.6.3 (2020-02-29), Holding the Windsock) на Ubuntu 18.04.4 LTS. Когда я пытаюсь установить 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’

Любая идея будет оценена.

1 Ответ

1 голос
/ 15 апреля 2020

решаемая. Причиной проблемы было то, что после серии обновлений Ubuntu и R в моей системе оставалось несколько устаревших пакетов, установленных из исходного кода.

Сначала я открыл консоль R и искал пути для R пакетов, собранных с версией до 3.6:

> 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/) пакеты из вывода предыдущих команд, и теперь все работает.

...