【问题标题】:Cannot install Rstan 2.21 library on CentOS 7 R 4.0.1无法在 CentOS 7 R 4.0.1 上安装 Rstan 2.21 库
【发布时间】:2020-09-01 19:19:49
【问题描述】:

我无法在 CentOS 7 机器上使用 R4.0.1 安装最新版本的 Rstan。 我按照此处的说明进行操作:https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Linux

我没有 linux 服务器的管理员权限,所以我想知道这是否意味着我需要让管理员安装 V8? 如果是这样,哪个版本 - brew 版本? (我不太懂 linux)。

非常感谢任何帮助。

这是错误:

-----------------------------[ ANTICONF ]-------------------------------
Configuration failed to find the libv8 engine library. Try installing:

deb: libv8-dev or libnode-dev (Debian / Ubuntu)
rpm: v8-devel (Fedora, EPEL)
brew: v8 (OSX)
csw: libv8_dev (Solaris)
To use a custom libv8, set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars=‘INCLUDE_DIR=… LIB_DIR=…’
---------------------------[ ERROR MESSAGE ]----------------------------
:1:10: fatal error: v8.h: No such file or directory
compilation terminated.
ERROR: configuration failed for package ‘V8’

removing ‘/home/jjannot/R/x86_64-pc-linux-gnu-library/4.0/V8’
ERROR: dependency ‘V8’ is not available for package ‘rstan’
removing ‘/home/jjannot/R/x86_64-pc-linux-gnu-library/4.0/rstan’
The downloaded source packages are in
‘/tmp/RtmpsiiC9D/downloaded_packages’
Warning messages:
1: In install.packages(“rstan”, type = “source”) :
installation of package ‘V8’ had non-zero exit status
2: In install.packages(“rstan”, type = “source”) :
installation of package ‘rstan’ had non-zero exit status

细节/规格:

操作系统 - CentOS 7

RStan 版本 - 2.21

输出

writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))

CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=/usr/bin/g++
CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=/opt/rh/devtoolset-7/root/usr/bin/g++
CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=g++

输出

devtools::session_info("rstan")─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 4.0.1 (2020-06-06)
os CentOS Linux 7 (Core)
system x86_64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Los_Angeles
date 2020-09-01
─ Packages ───────────────────────────────────────────────────────────────────
! package * version date lib source
R rstan [?]

[1] /home/jjannot/R/x86_64-pc-linux-gnu-library/4.0
[2] /opt/R/64-bit/R-4.0.1/lib64/R/library

R ── Package was removed from disk.

【问题讨论】:

  • 更新:我问系统管理员他们是否会安装 V8,并被告知运行这个 linux 命令scl enable devtoolset-9 bash。仍然得到同样的错误

标签: r rstan


【解决方案1】:

这是完整的解决方案,以防它可以帮助其他人。

在 CentOS 7 上:

从这里安装 V8 头文件和共享库:https://pkgs.org/download/v8-devel (EPEL_x86_64)

将 gcc (g++) 从版本 4 提升到 9.3.1

在 R 中:

移除 rstan 和 StanHeaders

安装在新的 R 会话中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-11
    • 2016-07-26
    • 2016-11-15
    • 2017-05-27
    • 2019-04-06
    • 2020-06-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多