简体   繁体   中英

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.

I'm using a amazonlinux docker image and to use drc I have de following lines to install it via 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:

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. conda is not used though. https://github.com/rpy2/rpy2-docker

If conda is needed, look at the images managed by the jupyter project for example.

I fixed a similar problem in a different container type by installing 'which'. This package is often omitted from linux enviroments because there are "better" alternatives. However, R package writers often still depend on 'which'. So figure out how to install this in your container and it may fix the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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