In a previous work, I used the 'reticulate' package to run the Autogluon autoML library in R. The code works well in my current configuration (Ubuntu 20.4, R 4.10, reticulate v. 125).
However, this code doesn't work in Docker.
Dockerfile
FROM rocker/r-ver:4.1.0
## Install R packages
RUN R -q -e 'install.packages("remotes")'
RUN R -q -e 'remotes::install_github("rstudio/reticulate")'
# Install Autogluon
RUN R -q -e 'reticulate::install_miniconda()'
RUN R -q -e 'reticulate::conda_create(envname = "r-autogluon", packages = c("python=3.8.13", "numpy"))'
# RUN R -q -e 'reticulate::conda_list()'
RUN R -q -e 'reticulate::conda_install(envname = "r-autogluon", packages = "autogluon", pip = TRUE)'
RUN R -e 'reticulate::use_condaenv("r-autogluon", required = TRUE)'
# RUN -q -e 'reticulate::py_config()'
EXPOSE 3838
CMD R -e 'reticulate::import("autogluon.tabular")'
# Run in shell
# sudo docker build --no-cache -t demo .
# sudo docker run --rm -p 3838:3838 demo
I meet this error and I don't know how to solve it!
reticulate::import("autogluon.tabular") Error in py_module_import(module, convert = convert) : ModuleNotFoundError: No module named 'autogluon' Calls: -> py_module_import Execution halted
Tracks
- The 'conda_list()' indicates that the "r-autogluon" has been created with success!
- The 'py_config()' indicates that the "r-reticulate" is used by default.
- The 'reticulate::use_condaenv("r-autogluon", required = TRUE)' doesn't work.
Anybody has a solution ?
use_condaenv
, and I had to specify withuse_python('/path/to/miniconda/envs/r-autogluon/bin/python')
, although that probably should have come up as a problem inpy_config()
– Monoplane