@@ -2,16 +2,23 @@ ARG BASE_TAG=latest
2
2
3
3
FROM gcr.io/kaggle-images/rcran:${BASE_TAG}
4
4
5
+ ARG PYTHON_VERSION=3.10
6
+
5
7
ADD clean-layer.sh /tmp/clean-layer.sh
6
8
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
11
18
12
19
RUN apt-get update && \
13
20
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 && \
15
22
pip install jupyter pycurl && \
16
23
# Install older tornado - https://github.com/jupyter/notebook/issues/4437
17
24
pip install "tornado<6" && \
@@ -33,11 +40,15 @@ RUN apt-get update && \
33
40
/tmp/clean-layer.sh
34
41
35
42
# 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"
38
48
39
49
# 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}\" )"
41
52
42
53
# Install kaggle libraries.
43
54
# Do this at the end to avoid rebuilding everything when any change is made.
0 commit comments