ai didi

r - 向仓库文件添加仓库

转载 作者:行者123 更新时间:2023-12-02 18:31:48 24 4
gpt4 key购买 nike

我正在尝试在我的Dokerfile中添加DMLC仓库,以便可以安装mxnet软件包。我这样做如下:

RUN R -e "install.packages('drat', repos='https://cran.rstudio.com')"
RUN R -e "drat::addRepo('dmlc')"
RUN R -e "install.packages('mxnet', #repos='https://dmlc.github.io/drat', dependencies=TRUE)"

这是行不通的。出乎意料的是,我注意到即使我添加了dmlc存储库,但实际上在我打印出以下命令的输出时却没有添加它:
RUN R -e "print(getOption('repos'))"

为了解决这个问题,我明确指定了存储库,如下所示:
#RUN R -e "install.packages('mxnet', #repos='https://dmlc.github.io/drat', dependencies=TRUE)"

但这仍然行不通。它抛出一个错误,说:

this is screenshot of the error

有什么帮助吗?我要做的就是在准备容器时在Dockerfile中安装mxnet。

最佳答案

一些建议:

  • 在将R命令与Docker一起使用之前,请确保R命令在Dockerfile外部成功运行。对于您遇到的错误消息,该文件不存在,因此安装失败:http://dmlc.ml/drat/src/contrib/mxnet_0.7.tar.gz
  • 我在macOS X El Capitan上尝试了以下步骤,并遇到依赖包rgexf和XML的错误。但是,您能否检查以下步骤在您的环境中是否可以正常工作?

  • https://mxnet.incubator.apache.org/get_started/install.html
      cran <- getOption("repos")
    cran["dmlc"] <- "https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/"
    options(repos = cran)
    install.packages("mxnet")

    我遇到的错误:
    Error in download.file(url, destfile, method, mode = "wb", ...) : 
    cannot download all files
    In addition: Warning message:
    In download.file(url, destfile, method, mode = "wb", ...) :
    URL 'https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/src/contrib/mxnet_0.10.1.tar.gz': status was '404 Not Found'
    Warning in download.packages(pkgs, destdir = tmpd, available = available, :
    download of package ‘mxnet’ failed
    ...
    ...
    ...
    ERROR: dependency ‘rgexf’ is not available for package ‘DiagrammeR’
    * removing ‘/usr/local/lib/R/3.3/site-library/DiagrammeR’

    The downloaded source packages are in
    ‘/private/var/folders/b2/d3rhxz3504q3q42dlx994wmnc9mg23/T/RtmpoUy7j7/downloaded_packages’
    Warning messages:
    1: In install.packages("mxnet") :
    installation of package ‘XML’ had non-zero exit status
    2: In install.packages("mxnet") :
    installation of package ‘igraph’ had non-zero exit status
    3: In install.packages("mxnet") :
    installation of package ‘rgexf’ had non-zero exit status
    4: In install.packages("mxnet") :
    installation of package ‘DiagrammeR’ had non-zero exit status

    然后,我尝试:
    cran <- getOption("repos")
    cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/"
    options(repos = cran)
    install.packages("mxnet")

    Error in download.file(url, destfile, method, mode = "wb", ...) :
    cannot download all files
    In addition: Warning message:
    In download.file(url, destfile, method, mode = "wb", ...) :
    URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/src/contrib/mxnet_0.10.1.tar.gz': status was '404 Not Found'
    Warning in download.packages(pkgs, destdir = tmpd, available = available, :
    download of package ‘mxnet’ failed

    注意:直到我遇到此错误,该错误不会停止安装:
    ** R
    ** demo
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    Error in dyn.load(file, DLLpath = DLLpath, ...) :
    unable to load shared object '/usr/local/lib/R/3.3/site-library/igraph/libs/igraph.so':
    dlopen(/usr/local/lib/R/3.3/site-library/igraph/libs/igraph.so, 6): Library not loaded: @rpath/libxml2.2.dylib
    Referenced from: /usr/local/lib/R/3.3/site-library/igraph/libs/igraph.so
    Reason: image not found
    Error: loading failed
    Execution halted
    ERROR: loading failed
    * removing ‘/usr/local/lib/R/3.3/site-library/igraph’
    * restoring previous ‘/usr/local/lib/R/3.3/site-library/igraph’
    ERROR: dependency ‘XML’ is not available for package ‘rgexf’
    * removing ‘/usr/local/lib/R/3.3/site-library/rgexf’
    ERROR: dependency ‘rgexf’ is not available for package ‘DiagrammeR’
    * removing ‘/usr/local/lib/R/3.3/site-library/DiagrammeR’

    这些步骤可能会在您的OS和环境上起作用。因此,请尝试将其发布在这里。

    后来,我在github上发现了这个问题。因此,您可以在此处跟踪此问题:

    https://github.com/apache/incubator-mxnet/issues/8926

    关于r - 向仓库文件添加仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41073812/

    24 4 0
    文章推荐: javascript - 如何在某些文件中使用这个node.js模块
    文章推荐: laravel - 跳过 Laravel 的 FormRequest 验证
    文章推荐: hibernate - 如何在 Query DSL 4 上使用 JPA 2.1 中的 loadgraph 和 fetchgraph
    文章推荐: javascript - 检测 AUI 对话框中按下的 Enter 键
    行者123
    个人简介

    我是一名优秀的程序员,十分优秀!

    滴滴打车优惠券免费领取
    滴滴打车优惠券
    全站热门文章
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com