Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Add conda-env if this buildpack is replacing another conda buildback without conda-env #1

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ PYTHONPATH='/app/.heroku/miniconda/lib/python2.7/site-packages:$PYTHONPATH'
if [ -f environment.yml ]; then
PYTHONPATH="/app/.heroku/miniconda/envs/heroku-env/lib/python2.7/site-packages:${PYTHONPATH}"
set-default-env CONDA_DEFAULT_ENV "heroku-env"
set-env PATH '$HOME/.heroku/miniconda/envs/heroku-env/bin:$PATH'
fi
set-default-env PYTHONPATH $PYTHONPATH
set-env PYTHONUNBUFFERED true
Expand Down
16 changes: 11 additions & 5 deletions bin/steps/conda_compile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/usr/bin/env bash
CONDA_VERSION=3.8.3
CONDA_VERSION=4.3.31
puts-step "Checking for existing conda install"
if [ ! -d /app/.heroku/miniconda ]; then
puts-step "Preparing Python/Miniconda Environment (${CONDA_VERSION})"
curl -Os http://repo.continuum.io/miniconda/Miniconda-${CONDA_VERSION}-Linux-x86_64.sh
bash Miniconda-${CONDA_VERSION}-Linux-x86_64.sh -p /app/.heroku/miniconda/ -b | indent
rm -fr Miniconda-${CONDA_VERSION}-Linux-x86_64.sh
curl -Os https://repo.continuum.io/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh
bash Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh -p /app/.heroku/miniconda/ -b | indent
rm -fr Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh

conda update conda --quiet --yes | indent
fi

(puts-step "Checking for conda env" && conda env &> /dev/null) || conda update conda --quiet --yes | indent

if [ -f conda-requirements.txt ]; then
puts-step "Installing dependencies using Conda"
Expand All @@ -18,8 +20,12 @@ fi
if [ -f environment.yml ]; then
puts-step "Creating conda environment"
# TODO: Use update if its already there
conda env remove --yes --quiet --name heroku-env
conda env remove --yes --quiet --name heroku-env || puts-step "No old environment to remove"
conda env create --name=heroku-env --file environment.yml
puts-step "Conda environment created"
source activate heroku-env
# conda install --yes nomkl numpy
# conda remove --yes mkl mkl-service
fi

# Clean up the installation environment .
Expand Down