Use miniforge instead of miniconda to get conda

[miniforge](https://github.com/conda-forge/miniforge) is a new
community-led installer that uses conda-forge as the default
channel, rather than defaults. This gives us a few advantages:

- No mixing of defaults & conda-forge channel by default. My
  intuition is that this will reduce image size & build times,
  but I don't know enough about conda to say if this is real
- It provides installers for architectures unsupported by miniconda.
  This is particularly useful important for ARM & PowerPC, when we
  want to support those better.
- I like conda-forge, and we should do what we can to support them!
  This is a fairly easy, drop-in way to do so
- It is more likely to have newer versions of conda by default
  than miniconda
- It provides sha256 hashes for installers rather than just md5. This
  makes me personally happy

There should be no user-facing changes here as far as I can tell.

Fixes #858
pull/859/head
YuviPanda 2020-03-04 14:52:34 +05:30
rodzic 26542dfc85
commit 0d0a2f8eb9
2 zmienionych plików z 18 dodań i 19 usunięć

Wyświetl plik

@ -63,7 +63,7 @@ class CondaBuildPack(BaseImage):
All scripts here should be independent of contents of the repository.
This sets up through `install-miniconda.bash` (found in this directory):
This sets up through `install-miniforge.bash` (found in this directory):
- a directory for the conda environment and its ownership by the
notebook user
@ -79,8 +79,8 @@ class CondaBuildPack(BaseImage):
(
"root",
r"""
bash /tmp/install-miniconda.bash && \
rm /tmp/install-miniconda.bash /tmp/environment.yml
bash /tmp/install-miniforge.bash && \
rm /tmp/install-miniforge.bash /tmp/environment.yml
""",
)
]
@ -103,7 +103,7 @@ class CondaBuildPack(BaseImage):
"""
files = {
"conda/install-miniconda.bash": "/tmp/install-miniconda.bash",
"conda/install-miniforge.bash": "/tmp/install-miniforge.bash",
"conda/activate-conda.sh": "/etc/profile.d/activate-conda.sh",
}
py_version = self.python_version

Wyświetl plik

@ -3,14 +3,13 @@
set -ex
cd $(dirname $0)
MINICONDA_VERSION=4.7.12.1
CONDA_VERSION=4.7.12
# Only MD5 checksums are available for miniconda
# Can be obtained from https://repo.continuum.io/miniconda/
MD5SUM="81c773ff87af5cfac79ab862942ab6b3"
MINIFORGE_VERSION=4.8.2-1
CONDA_VERSION=4.8.2
# SHA256 for installers can be obtained from https://github.com/conda-forge/miniforge/releases
SHA256SUM="4f897e503bd0edfb277524ca5b6a5b14ad818b3198c2f07a36858b7d88c928db"
URL="https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh"
INSTALLER_PATH=/tmp/miniconda-installer.sh
URL="https://github.com/conda-forge/miniforge/releases/download/4.8.2-1/Miniforge3-${MINIFORGE_VERSION}-Linux-x86_64.sh"
INSTALLER_PATH=/tmp/miniforge-installer.sh
# make sure we don't do anything funky with user's $HOME
# since this is run as root
@ -19,8 +18,8 @@ unset HOME
wget --quiet $URL -O ${INSTALLER_PATH}
chmod +x ${INSTALLER_PATH}
# check md5 checksum
if ! echo "${MD5SUM} ${INSTALLER_PATH}" | md5sum --quiet -c -; then
# check sha256 checksum
if ! echo "${SHA256SUM} ${INSTALLER_PATH}" | sha256sum --quiet -c -; then
echo "md5sum mismatch for ${INSTALLER_PATH}, exiting!"
exit 1
fi
@ -28,9 +27,6 @@ fi
bash ${INSTALLER_PATH} -b -p ${CONDA_DIR}
export PATH="${CONDA_DIR}/bin:$PATH"
# Allow easy direct installs from conda forge
conda config --system --add channels conda-forge
# Do not attempt to auto update conda or dependencies
conda config --system --set auto_update_conda false
conda config --system --set show_channel_urls true
@ -38,8 +34,11 @@ conda config --system --set show_channel_urls true
# bug in conda 4.3.>15 prevents --set update_dependencies
echo 'update_dependencies: false' >> ${CONDA_DIR}/.condarc
# install conda itself
if [[ "${CONDA_VERSION}" != "${MINICONDA_VERSION}" ]]; then
# install conda itself, if needed
# FIXME: MINIFORGE_VERSION might have a build number, like -1.
# This will force conda to be installed each time
# Use a better way of finding conda version!
if [[ "${CONDA_VERSION}" != "${MINIFORGE_VERSION}" ]]; then
conda install -yq conda==${CONDA_VERSION}
fi
@ -81,7 +80,7 @@ conda clean --all -f -y
# Remove the big installer so we don't increase docker image size too much
rm ${INSTALLER_PATH}
# Remove the pip cache created as part of installing miniconda
# Remove the pip cache created as part of installing miniforge
rm -rf /root/.cache
chown -R $NB_USER:$NB_USER ${CONDA_DIR}