2

我正在尝试在我的 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'))"

为了解决这个问题,我明确指定了 repos,如下所示:

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

这仍然没有奏效。它抛出一个错误说:

这是错误的截图

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

4

1 回答 1

1

几点建议:

  1. 在将 R 命令与 Docker 一起使用之前,请确保它们在 Dockerfile 之外成功运行。对于您遇到的错误消息,该文件不存在,因此安装失败:http ://dmlc.ml/drat/src/contrib/mxnet_0.7.ta​​r.gz

  2. 我在 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’

这些步骤可能适用于您的操作系统和环境。因此,请尝试它们并在此处发布您的发现。

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

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

于 2017-12-10T22:33:37.450 回答