简体   繁体   English

Docker 中的 R、Python、rpy2 和 drc 包

[英]R, Python, rpy2 and drc package in Docker

I'm trying to build a docker image to execute a python proces which calls (with rpy2) the package drc from R.我正在尝试构建一个 docker 映像来执行一个 python 进程,该进程调用(使用 rpy2)来自 R 的包drc

I'm using a amazonlinux docker image and to use drc I have de following lines to install it via conda:我正在使用amazonlinux docker映像并使用drc我有以下几行通过conda安装它:

RUN conda install -c r rpy2=2.9.4 --yes
RUN conda install -c conda-forge r-drc=3.0_1 --yes

With the image build I enter into a running container with:通过镜像构建,我进入了一个正在运行的容器:

docker run -it --entrypoint bash mydockerName

And when I enter to R via R it throws me the next error:当我通过R进入 R 时,它会抛出下一个错误:

Error: package or namespace load failed for 'utils':
 .onLoad failed in loadNamespace() for 'utils', details:
  call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
  error: error in running command
Error: package or namespace load failed for 'stats':
 .onLoad failed in loadNamespace() for 'utils', details:
  call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
  error: error in running command
During startup - Warning messages:
1: package 'utils' in options("defaultPackages") was not found
2: package 'stats' in options("defaultPackages") was not found

I've been googling the last days and I'm out of possible solutions...我最近几天一直在谷歌搜索,但没有可能的解决方案......

Many thanks!非常感谢!

Xevi西维

The rpy2 project has images that could constitute a starting point. rpy2 项目具有可以构成起点的图像。 conda is not used though.虽然没有使用conda https://github.com/rpy2/rpy2-docker https://github.com/rpy2/rpy2-docker

If conda is needed, look at the images managed by the jupyter project for example.如果conda是必要的,看,例如,用jupyter项目管理的图像。

I fixed a similar problem in a different container type by installing 'which'.我通过安装“which”修复了不同容器类型中的类似问题。 This package is often omitted from linux enviroments because there are "better" alternatives.这个包经常从 linux 环境中省略,因为有“更好”的替代品。 However, R package writers often still depend on 'which'.但是,R 包编写者通常仍然依赖于“哪个”。 So figure out how to install this in your container and it may fix the issue.因此,搞清楚如何安装这个在你的容器,它可以解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM