From 5b92cd5e72ca26461013a705e0b8688619c21fea Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Wed, 27 Jun 2018 15:41:34 -0700 Subject: [PATCH] Use miniconda3 directly, do not use conda constructor Conda constructor wasn't providing enough use to justify its restrictions: 1. It doesn't work with most of conda-forge due to https://github.com/conda/constructor/issues/86#issuecomment-330863531. Almost all the packages we want to ship are in conda-forge. 2. There is no way to pass environment variables to the post-install script, which makes customization super hard. 3. Can't bundle pip packages, so we need internet access to install packages anyway. This negates the 'offline installable' aspect of conda constructor. 4. We need an installer script that users can curl into bash regardless. Downloading & installing miniconda straight up seems simple enough for now, and has a reasonable upgrade pathway. I think it'll work out ok! --- installer/construct.yaml | 16 -------------- installer/install.bash | 42 +++++++++++++++++++++++++++++++++++++ installer/post-install.bash | 10 --------- 3 files changed, 42 insertions(+), 26 deletions(-) delete mode 100644 installer/construct.yaml create mode 100755 installer/install.bash delete mode 100755 installer/post-install.bash diff --git a/installer/construct.yaml b/installer/construct.yaml deleted file mode 100644 index 440640b..0000000 --- a/installer/construct.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: TheLittlestJupyterHub -version: 0.1 - -channels: - - http://repo.continuum.io/pkgs/free/ - - https://conda.anaconda.org/conda-forge - -conda_default_channels: - - http://repo.continuum.io/pkgs/free/ - - https://conda.anaconda.org/conda-forge - -specs: - - python 3.6 - - conda - -post_install: post-install.bash diff --git a/installer/install.bash b/installer/install.bash new file mode 100755 index 0000000..654ad6d --- /dev/null +++ b/installer/install.bash @@ -0,0 +1,42 @@ +#!/usr/bin/bash +set -exuo pipefail + +# Set up defaults for configurable env vars +TLJH_INSTALL_PREFIX=${TLJH_INSTALL_PREFIX:-/opt/tljh} +TLJH_INSTALL_PIP_SPEC=${TLJH_INSTALL_SPEC:-git+https://github.com/yuvipanda/the-littlest-jupyterhub.git} +TLJH_INSTALL_PIP_FLAGS=${TLJH_PIP_FLAGS:---no-cache-dir} + + +function install_miniconda { + CONDA_DIR=${1} + CONDA_VERSION=4.5.4 + URL="https://repo.continuum.io/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh" + INSTALLER_PATH=/tmp/miniconda-installer.sh + + wget $URL -O ${INSTALLER_PATH} + chmod +x ${INSTALLER_PATH} + + # Only MD5 checksums are available for miniconda + # Can be obtained from https://repo.continuum.io/miniconda/ + MD5SUM="a946ea1d0c4a642ddf0c3a26a18bb16d" + + if ! echo "${MD5SUM} ${INSTALLER_PATH}" | md5sum --quiet -c -; then + echo "md5sum mismatch for ${INSTALLER_PATH}, exiting!" + exit 1 + fi + + bash ${INSTALLER_PATH} -b -p ${CONDA_DIR} + + # Allow easy direct installs from conda forge + ${CONDA_DIR}/bin/conda config --system --add channels conda-forge + + # Do not attempt to auto update conda or dependencies + ${CONDA_DIR}/bin/conda config --system --set auto_update_conda false + ${CONDA_DIR}/bin/conda config --system --set show_channel_urls true +} + +HUB_CONDA_DIR=${TLJH_INSTALL_PREFIX}/hub +install_miniconda ${HUB_CONDA_DIR} +${HUB_CONDA_DIR}/bin/pip install ${TLJH_INSTALL_PIP_FLAGS} ${TLJH_INSTALL_PIP_SPEC} + +${HUB_CONDA_DIR}/bin/python3 -m tljh.installer diff --git a/installer/post-install.bash b/installer/post-install.bash deleted file mode 100755 index 7464118..0000000 --- a/installer/post-install.bash +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/bash -set -euo pipefail - -# Run by the installer after the hub environment has been set up. - -export PATH=${PREFIX}/bin:$PATH - -pip install --no-cache-dir git+https://github.com/yuvipanda/the-littlest-jupyterhub.git - -python3 -m tljh.installer