kopia lustrzana https://github.com/jupyterhub/repo2docker
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 #858pull/859/head
rodzic
26542dfc85
commit
0d0a2f8eb9
|
@ -63,7 +63,7 @@ class CondaBuildPack(BaseImage):
|
||||||
|
|
||||||
All scripts here should be independent of contents of the repository.
|
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
|
- a directory for the conda environment and its ownership by the
|
||||||
notebook user
|
notebook user
|
||||||
|
@ -79,8 +79,8 @@ class CondaBuildPack(BaseImage):
|
||||||
(
|
(
|
||||||
"root",
|
"root",
|
||||||
r"""
|
r"""
|
||||||
bash /tmp/install-miniconda.bash && \
|
bash /tmp/install-miniforge.bash && \
|
||||||
rm /tmp/install-miniconda.bash /tmp/environment.yml
|
rm /tmp/install-miniforge.bash /tmp/environment.yml
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -103,7 +103,7 @@ class CondaBuildPack(BaseImage):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
files = {
|
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",
|
"conda/activate-conda.sh": "/etc/profile.d/activate-conda.sh",
|
||||||
}
|
}
|
||||||
py_version = self.python_version
|
py_version = self.python_version
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
MINICONDA_VERSION=4.7.12.1
|
MINIFORGE_VERSION=4.8.2-1
|
||||||
CONDA_VERSION=4.7.12
|
CONDA_VERSION=4.8.2
|
||||||
# Only MD5 checksums are available for miniconda
|
# SHA256 for installers can be obtained from https://github.com/conda-forge/miniforge/releases
|
||||||
# Can be obtained from https://repo.continuum.io/miniconda/
|
SHA256SUM="4f897e503bd0edfb277524ca5b6a5b14ad818b3198c2f07a36858b7d88c928db"
|
||||||
MD5SUM="81c773ff87af5cfac79ab862942ab6b3"
|
|
||||||
|
|
||||||
URL="https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh"
|
URL="https://github.com/conda-forge/miniforge/releases/download/4.8.2-1/Miniforge3-${MINIFORGE_VERSION}-Linux-x86_64.sh"
|
||||||
INSTALLER_PATH=/tmp/miniconda-installer.sh
|
INSTALLER_PATH=/tmp/miniforge-installer.sh
|
||||||
|
|
||||||
# make sure we don't do anything funky with user's $HOME
|
# make sure we don't do anything funky with user's $HOME
|
||||||
# since this is run as root
|
# since this is run as root
|
||||||
|
@ -19,8 +18,8 @@ unset HOME
|
||||||
wget --quiet $URL -O ${INSTALLER_PATH}
|
wget --quiet $URL -O ${INSTALLER_PATH}
|
||||||
chmod +x ${INSTALLER_PATH}
|
chmod +x ${INSTALLER_PATH}
|
||||||
|
|
||||||
# check md5 checksum
|
# check sha256 checksum
|
||||||
if ! echo "${MD5SUM} ${INSTALLER_PATH}" | md5sum --quiet -c -; then
|
if ! echo "${SHA256SUM} ${INSTALLER_PATH}" | sha256sum --quiet -c -; then
|
||||||
echo "md5sum mismatch for ${INSTALLER_PATH}, exiting!"
|
echo "md5sum mismatch for ${INSTALLER_PATH}, exiting!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -28,9 +27,6 @@ fi
|
||||||
bash ${INSTALLER_PATH} -b -p ${CONDA_DIR}
|
bash ${INSTALLER_PATH} -b -p ${CONDA_DIR}
|
||||||
export PATH="${CONDA_DIR}/bin:$PATH"
|
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
|
# Do not attempt to auto update conda or dependencies
|
||||||
conda config --system --set auto_update_conda false
|
conda config --system --set auto_update_conda false
|
||||||
conda config --system --set show_channel_urls true
|
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
|
# bug in conda 4.3.>15 prevents --set update_dependencies
|
||||||
echo 'update_dependencies: false' >> ${CONDA_DIR}/.condarc
|
echo 'update_dependencies: false' >> ${CONDA_DIR}/.condarc
|
||||||
|
|
||||||
# install conda itself
|
# install conda itself, if needed
|
||||||
if [[ "${CONDA_VERSION}" != "${MINICONDA_VERSION}" ]]; then
|
# 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}
|
conda install -yq conda==${CONDA_VERSION}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@ conda clean --all -f -y
|
||||||
# Remove the big installer so we don't increase docker image size too much
|
# Remove the big installer so we don't increase docker image size too much
|
||||||
rm ${INSTALLER_PATH}
|
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
|
rm -rf /root/.cache
|
||||||
|
|
||||||
chown -R $NB_USER:$NB_USER ${CONDA_DIR}
|
chown -R $NB_USER:$NB_USER ${CONDA_DIR}
|
Ładowanie…
Reference in New Issue