From 476829f0f47e7b7d57bd105b017d4c07c00319e3 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Tue, 3 May 2022 15:51:38 +0200 Subject: [PATCH] Proposed improvements for G_SLICE (#1697) * Try to fix mamba under aarch64 QEMU by setting ENV G_SLICE=always-malloc * Set G_SLICE inside if statement * Write "extract_threads: 1" to /opt/.condarc Co-authored-by: Ayaz Salikhov --- all-spark-notebook/Dockerfile | 8 +++++++- base-notebook/Dockerfile | 3 ++- datascience-notebook/Dockerfile | 8 +++++++- pyspark-notebook/Dockerfile | 8 +++++++- r-notebook/Dockerfile | 8 +++++++- scipy-notebook/Dockerfile | 8 +++++++- tensorflow-notebook/Dockerfile | 8 +++++++- 7 files changed, 44 insertions(+), 7 deletions(-) diff --git a/all-spark-notebook/Dockerfile b/all-spark-notebook/Dockerfile index 3f35e700..684c9ddb 100644 --- a/all-spark-notebook/Dockerfile +++ b/all-spark-notebook/Dockerfile @@ -27,7 +27,13 @@ RUN apt-get update --yes && \ USER ${NB_UID} # R packages including IRKernel which gets installed globally. -RUN mamba install --quiet --yes \ +RUN arch=$(uname -m) && \ + if [ "${arch}" == "aarch64" ]; then \ + # Prevent libmamba from sporadically hanging on arm64 under QEMU + # + export G_SLICE=always-malloc; \ + fi && \ + mamba install --quiet --yes \ 'r-base' \ 'r-ggplot2' \ 'r-irkernel' \ diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 376bb5fb..7943cbad 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -119,7 +119,8 @@ RUN set -x && \ if [ "${arch}" == "aarch64" ]; then \ # Prevent libmamba from sporadically hanging on arm64 under QEMU # - ./micromamba config set extract_threads 1; \ + # We don't use `micromamba config set` since it instead modifies ~/.condarc. + echo "extract_threads: 1" >> "${CONDA_DIR}/.condarc"; \ fi && \ # Install the packages ./micromamba install \ diff --git a/datascience-notebook/Dockerfile b/datascience-notebook/Dockerfile index ef89e642..47a624fc 100644 --- a/datascience-notebook/Dockerfile +++ b/datascience-notebook/Dockerfile @@ -61,7 +61,13 @@ USER ${NB_UID} # R packages including IRKernel which gets installed globally. # r-e1071: dependency of the caret R package -RUN mamba install --quiet --yes \ +RUN arch=$(uname -m) && \ + if [ "${arch}" == "aarch64" ]; then \ + # Prevent libmamba from sporadically hanging on arm64 under QEMU + # + export G_SLICE=always-malloc; \ + fi && \ + mamba install --quiet --yes \ 'r-base' \ 'r-caret' \ 'r-crayon' \ diff --git a/pyspark-notebook/Dockerfile b/pyspark-notebook/Dockerfile index 6be3c924..9a3f5417 100644 --- a/pyspark-notebook/Dockerfile +++ b/pyspark-notebook/Dockerfile @@ -61,7 +61,13 @@ RUN fix-permissions "/etc/ipython/" USER ${NB_UID} # Install pyarrow -RUN mamba install --quiet --yes \ +RUN arch=$(uname -m) && \ + if [ "${arch}" == "aarch64" ]; then \ + # Prevent libmamba from sporadically hanging on arm64 under QEMU + # + export G_SLICE=always-malloc; \ + fi && \ + mamba install --quiet --yes \ 'pyarrow' && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile index 3319a802..dac8757c 100644 --- a/r-notebook/Dockerfile +++ b/r-notebook/Dockerfile @@ -27,7 +27,13 @@ USER ${NB_UID} # R packages including IRKernel which gets installed globally. # r-e1071: dependency of the caret R package -RUN mamba install --quiet --yes \ +RUN arch=$(uname -m) && \ + if [ "${arch}" == "aarch64" ]; then \ + # Prevent libmamba from sporadically hanging on arm64 under QEMU + # + export G_SLICE=always-malloc; \ + fi && \ + mamba install --quiet --yes \ 'r-base' \ 'r-caret' \ 'r-crayon' \ diff --git a/scipy-notebook/Dockerfile b/scipy-notebook/Dockerfile index 9385e7d7..7bd6caf8 100644 --- a/scipy-notebook/Dockerfile +++ b/scipy-notebook/Dockerfile @@ -26,7 +26,13 @@ RUN apt-get update --yes && \ USER ${NB_UID} # Install Python 3 packages -RUN mamba install --quiet --yes \ +RUN arch=$(uname -m) && \ + if [ "${arch}" == "aarch64" ]; then \ + # Prevent libmamba from sporadically hanging on arm64 under QEMU + # + export G_SLICE=always-malloc; \ + fi && \ + mamba install --quiet --yes \ 'altair' \ 'beautifulsoup4' \ 'bokeh' \ diff --git a/tensorflow-notebook/Dockerfile b/tensorflow-notebook/Dockerfile index 78a8af28..65bf7999 100644 --- a/tensorflow-notebook/Dockerfile +++ b/tensorflow-notebook/Dockerfile @@ -11,7 +11,13 @@ LABEL maintainer="Jupyter Project " SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Install Tensorflow -RUN mamba install --quiet --yes \ +RUN arch=$(uname -m) && \ + if [ "${arch}" == "aarch64" ]; then \ + # Prevent libmamba from sporadically hanging on arm64 under QEMU + # + export G_SLICE=always-malloc; \ + fi && \ + mamba install --quiet --yes \ 'tensorflow' && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \