【问题标题】:Error Installing redux R package on centos7在 centos7 上安装 redux R 包时出错
【发布时间】:2022-09-30 21:51:14
【问题描述】:

尝试在 centos7 上安装 redux r 包时出错,不知道如何修复它。以前有人遇到过吗?

我的 Dockerfile 是:

FROM centos:centos7

RUN yum -y install wget git tar

RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

RUN yum -y install epel-release openssh-server

ENV R_VERSION=4.0.5

RUN wget https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm \\
  && yum -y install R-${R_VERSION}-1-1.x86_64.rpm \\
  && rm R-${R_VERSION}-1-1.x86_64.rpm

ENV PATH=\"${PATH}:/opt/R/${R_VERSION}/bin/\"

RUN yum -y install openssl-devel


RUN Rscript -e \"install.packages(c(\'redux\'), repos = \'https://packagemanager.rstudio.com/all/__linux__/centos7/latest\')\"

RUN Rscript -e \"library(redux)\"

CMD [\"/bin/bash\"]

然后我构建图像:

docker build -t test-3:latest .

我得到的错误是:

=> ERROR [8/8] RUN Rscript -e \"library(redux)\"                                                                                                                                                                    0.6s
------                                                                                                                                                                                                                  
 > [8/8] RUN Rscript -e \"library(redux)\":                                                                                                                                                                               
#12 0.528 Error: package or namespace load failed for \'redux\' in dyn.load(file, DLLpath = DLLpath, ...):                                                                                                                
#12 0.528  unable to load shared object \'/opt/R/4.0.5/lib/R/library/redux/libs/redux.so\':                                                                                                                               
#12 0.528   libhiredis.so.0.12: cannot open shared object file: No such file or directory                                                                                                                               
#12 0.528 Execution halted
------
executor failed running [/bin/sh -c Rscript -e \"library(redux)\"]: exit code: 1

附言。我能够安装任何其他软件包并毫无问题地引用它

  • 顺便说一句,为了优化你的 Docker 镜像,我建议将一堆 yum install 行合并到一个 RUN 命令中。每个 RUN 命令都会创建一个新层,这在这里有点毫无意义。

标签: r docker centos7


【解决方案1】:

该文件似乎来自hiredis 包:https://rhel.pkgs.org/7/okey-x86_64/hiredis-0.12.1-1.el7.centos.x86_64.rpm.html

尝试添加行 RUN yum -y install hiredis 或者将该软件包添加到您现有的 yum install 行之一。

【讨论】:

  • 谢谢达成相同的解决方案哈哈
【解决方案2】:

事实证明,我还必须安装 hiredis 才能成功加载包

更新了 dockerfile:

FROM centos:centos7

RUN yum -y install wget git tar

RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

RUN yum -y install epel-release openssh-server

ENV R_VERSION=4.0.5

RUN wget https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm \
  && yum -y install R-${R_VERSION}-1-1.x86_64.rpm \
  && rm R-${R_VERSION}-1-1.x86_64.rpm

ENV PATH="${PATH}:/opt/R/${R_VERSION}/bin/"

RUN yum -y install openssl-devel hiredis


RUN Rscript -e "install.packages(c('redux'), repos = 'https://packagemanager.rstudio.com/all/__linux__/centos7/latest')"

RUN Rscript -e "library(redux)"

CMD ["/bin/bash"]

【讨论】:

    猜你喜欢
    • 2016-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多