Skip to content

Commit e04d300

Browse files
committed
fix: consolidate to Python 3.12 in pythonr image
Two Python versions were present in the pythonr image: - 3.12 at /usr/local/bin/python (intentional, from base image) - 3.11 at /usr/bin/python3 (unintentional, pulled in as a transitive apt dependency when pak/sf resolves GDAL system libs on Debian 12) Fixes: - pythonr/Dockerfile: register /usr/local/bin/python as the higher-priority python3 alternative via update-alternatives, so both 'python' and 'python3' resolve to 3.12 without breaking system packages that depend on the binary - python/Dockerfile: add python.defaultInterpreterPath to the devcontainer.metadata LABEL so VSCode selects 3.12 automatically in any derived devcontainer Closes #132
1 parent 64500ac commit e04d300

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

python/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ${PYTHON_BASE_IMAGE}
33

44
ARG QUARTO_VERSION=1.9.37
55

6-
LABEL devcontainer.metadata='[{"customizations":{"vscode":{"extensions":["quarto.quarto","ms-python.python","ms-toolsai.jupyter"]}}}]'
6+
LABEL devcontainer.metadata='[{"customizations":{"vscode":{"extensions":["quarto.quarto","ms-python.python","ms-toolsai.jupyter"],"settings":{"python.defaultInterpreterPath":"/usr/local/bin/python"}}}}]'
77

88
# Install dependencies, git, and gh cli
99
RUN apt-get update && apt-get install -y --no-install-recommends \

pythonr/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ ENV PATH="/opt/R/${R_VERSION}/bin:${PATH}"
1717
ENV R_PKG_TYPE=binary
1818
ENV RETICULATE_PYTHON="/usr/local/bin/python"
1919

20+
# Ensure python3 resolves to the 3.12 interpreter from the base image,
21+
# not the Debian system Python 3.11 pulled in as a transitive dependency.
22+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python 10
23+
2024
RUN mkdir -p /etc/R && \
2125
echo "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest'))" > /etc/R/Rprofile.site && \
2226
mkdir -p /root && \

0 commit comments

Comments
 (0)