![](/img/trans.png)
[英]CentOS7 using R to install clusterProfiler get error about openssl
[英]Unable to install R library of facebook prophet on CentOS7
我正在嘗試在 centOS 7 上為 Facebook 的prophet
安裝R
庫。為了便於重現,我提供了一個dockerfile
和命令。
FROM centos:7
RUN yum -y install epel-release
RUN yum -y groupinstall "Development Tools"
RUN yum -y install proj
RUN yum -y install udunits2-devel
RUN yum -y install openssl-devel
RUN yum -y install libjpeg-turbo-devel
RUN yum -y install libcurl-devel
RUN yum -y install v8-devel
RUN yum -y install R
要構建 dockerfile,請使用以下命令。
docker build -t test_prophet_installation .
構建完成后,我使用下一個命令運行容器。
docker run -it --entrypoint=/bin/bash test_prophet_installation
現在,我在我的容器里。 我嘗試使用以下命令安裝prophet
。
su - -c "R -e \"install.packages('prophet', repos='http://cran.rstudio.com/')\""
上面的命令說,對一個依賴prophet
即rstan
安裝失敗。 所以我嘗試使用以下命令安裝“rstan”。
su - -c "R -e \"install.packages('rstan', repos='http://cran.rstudio.com/')\""
運行上述命令后,出現以下錯誤。
Error in .shlib_internal(args) :
C++14 standard requested but CXX14 is not defined
* removing '/usr/lib64/R/library/rstan'
The downloaded source packages are in
'/tmp/RtmpsPDQ9G/downloaded_packages'
Updating HTML index of packages in '.Library'
Warning messages:
1: In install.packages("rstan", repos = "http://cran.rstudio.com/") :
installation of package 'rstan' had non-zero exit status
2: In file.create(f.tg) :
cannot create file '/usr/share/doc/R-3.6.0/html/packages.html', reason 'No such file or directory'
3: In make.packages.html(.Library) : cannot update HTML package index
我嘗試了幾乎所有來自谷歌的故障排除來解決上述錯誤仍然沒有運氣。 我想,我沒有正確設置一些環境變量。
這里的問題是,使用時yum groupinstall "Development Tools"
,安裝GCC 4.8.5是,因此不支持C ++ 14(因為你可以看到這里)。
為了解決這個問題,您需要添加以下內容:
RUN yum -y install centos-release-scl
RUN yum -y install devtoolset-8-gcc*
RUN scl enable devtoolset-8 sh
最重要的是,您必須為rstan
定義rstan
。 你可以在這里找到解釋: https : //github.com/stan-dev/rstan/issues/569
我創建了這個 Makevars:
CXX14 = g++ -std=c++1y -Wno-unused-variable -Wno-unused-function -fPIC
並在我的 Dockerfile 中添加了一個 COPY:
COPY Makevars /root/.R/Makevars
我正在使用以下命令下載軟件包:
install.packages('rstan', repos='http://cran.rstudio.com/', dependencies = TRUE)
有些事情仍然沒有按預期工作,但這是向前邁出的一步。
編輯:這種方法不起作用,因為系統一直使用舊的 g++。 我最終使用了 docker 鏡像centos/devtoolset-7-toolchain-centos7:latest
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.