Skip to content

Commit

Permalink
pyvenv -> miniconda
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Apr 24, 2018
1 parent 08a9712 commit 9c32624
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions docker/user_python-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
#!/usr/bin/env bash
[ -f .bashrc ] && . .bashrc
INSTALL_DIR="${1:-/opt/pyvenv}"
PYTHON="${2:-miniconda}"

# Python (virtualenv)
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
python2 get-pip.py
rm get-pip.py
python2 -m pip install -U pip virtualenv
python2 -m virtualenv "$INSTALL_DIR"
source "$INSTALL_DIR"/bin/activate
# Python
case "$PYTHON" in
miniconda)
# miniconda
curl https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh > miniconda.sh
echo -e "\nyes\n${INSTALL_DIR}" | bash miniconda.sh
rm miniconda.sh
source "$INSTALL_DIR"/bin/activate
conda config --add channels conda-forge
conda update -c conda-forge -y conda
conda update -c conda-forge -y --all
;;
*python*)
# virtualenv
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
${PYTHON} get-pip.py
rm get-pip.py
${PYTHON} -m pip install -U pip virtualenv
${PYTHON} -m virtualenv "$INSTALL_DIR"
source "$INSTALL_DIR"/bin/activate
;;
*)
>&2 echo "unknown '\$PYTHON' '$PYTHON'"
exit 1
;;
esac

# Python (runtime)
if [ -f requirements.txt ]; then
pip install -U -r requirements.txt
fi

if [ "$PYTHON" = "miniconda" ]; then
conda update -c conda-forge -y --all
conda clean -y --all
fi

0 comments on commit 9c32624

Please sign in to comment.