@@ -2,16 +2,23 @@ ARG BASE_TAG=latest
22
33FROM gcr.io/kaggle-images/rcran:${BASE_TAG}
44
5+ ARG PYTHON_VERSION=3.10
6+
57ADD clean-layer.sh /tmp/clean-layer.sh
68
7- # Default to python3.8
8- RUN ln -sf /usr/bin/python3.8 /usr/bin/python
9- RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
10- RUN python get-pip.py
9+ # Install Python
10+ RUN apt-get install -y software-properties-common && \
11+ add-apt-repository ppa:deadsnakes/ppa -y && \
12+ apt-get update && \
13+ echo "MOD: python${PYTHON_VERSION}" && \
14+ apt-get install -y python${PYTHON_VERSION} && \
15+ ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
16+ curl -sS https://bootstrap.pypa.io/get-pip.py | python && \
17+ /tmp/clean-layer.sh
1118
1219RUN apt-get update && \
1320 apt-get install -y libzmq3-dev default-jdk && \
14- apt-get install -y python3.8 -dev libcurl4-openssl-dev libssl-dev && \
21+ apt-get install -y python${PYTHON_VERSION} -dev python3-venv libcurl4-openssl-dev libssl-dev && \
1522 pip install jupyter pycurl && \
1623 # Install older tornado - https://github.com/jupyter/notebook/issues/4437
1724 pip install "tornado<6" && \
@@ -33,11 +40,15 @@ RUN apt-get update && \
3340 /tmp/clean-layer.sh
3441
3542# Miniconda
36- RUN R -e 'reticulate::install_miniconda()'
37- ENV RETICULATE_PYTHON=/root/.local/share/r-miniconda/envs/r-reticulate/bin/python
43+ ARG MINICONDA_PATH=/root/.local/share/r-miniconda
44+ ARG ENV_NAME=r-reticulate
45+ RUN R -e "reticulate::install_miniconda(path = \" ${MINICONDA_PATH}\" , update = TRUE, force = TRUE)"
46+ RUN R -e "reticulate::conda_create(envname = \" ${ENV_NAME}\" , conda = \" auto\" , required = TRUE, python_version = \" ${PYTHON_VERSION}\" )"
47+ ENV RETICULATE_PYTHON="${MINICONDA_PATH}/envs/${ENV_NAME}/bin/python"
3848
3949# Tensorflow and Keras
40- RUN R -e 'keras::install_keras(tensorflow = "2.6", extra_packages = c("pandas", "numpy", "pycryptodome"), method="conda")'
50+ ARG TENSORFLOW_VERSION=2.11.0
51+ RUN R -e "keras::install_keras(tensorflow = \" ${TENSORFLOW_VERSION}\" , extra_packages = c(\" pandas\" , \" numpy\" , \" pycryptodome\" ), method=\" conda\" , envname=\" ${ENV_NAME}\" )"
4152
4253# Install kaggle libraries.
4354# Do this at the end to avoid rebuilding everything when any change is made.
0 commit comments