diff --git a/repo2docker/buildpacks/conda/install-miniconda.bash b/repo2docker/buildpacks/conda/install-miniconda.bash index d4beab52..f88433b2 100755 --- a/repo2docker/buildpacks/conda/install-miniconda.bash +++ b/repo2docker/buildpacks/conda/install-miniconda.bash @@ -20,31 +20,43 @@ if ! echo "${MD5SUM} ${INSTALLER_PATH}" | md5sum --quiet -c -; then fi bash ${INSTALLER_PATH} -b -p ${CONDA_DIR} +export PATH="${CONDA_DIR}/bin:$PATH" # Allow easy direct installs from conda forge -${CONDA_DIR}/bin/conda config --system --add channels conda-forge +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 config --system --set auto_update_conda false +conda config --system --set show_channel_urls true + +# switch Python in its own step +# since switching Python during an env update can +# prevent pip installation. +# we wouldn't have this issue if we did `conda env create` +# instead of `conda env update` in these cases +conda install -y $(cat /tmp/environment.yml | grep -o '\spython=.*') + # bug in conda 4.3.>15 prevents --set update_dependencies echo 'update_dependencies: false' >> ${CONDA_DIR}/.condarc -${CONDA_DIR}/bin/conda config --system --set show_channel_urls true -# disable pip cache for conda-triggered pip installs -export PIP_CACHE_DIR=0 +echo "installing root env:" +cat /tmp/environment.yml +conda env update -n root -f /tmp/environment.yml -${CONDA_DIR}/bin/conda env update -n root -f /tmp/environment.yml # enable nteract-on-jupyter, which was installed with pip jupyter serverextension enable nteract_on_jupyter --sys-prefix if [[ -f /tmp/kernel-environment.yml ]]; then # install kernel env and register kernelspec - ${CONDA_DIR}/bin/conda env create -n kernel -f /tmp/kernel-environment.yml + echo "installing kernel env:" + cat /tmp/kernel-environment.yml + + conda env create -n kernel -f /tmp/kernel-environment.yml ${CONDA_DIR}/envs/kernel/bin/ipython kernel install --prefix "${CONDA_DIR}" fi # Clean things out! -${CONDA_DIR}/bin/conda clean -tipsy +conda clean -tipsy # Remove the big installer so we don't increase docker image size too much rm ${INSTALLER_PATH}