Skip to content

Instantly share code, notes, and snippets.

@ruxi
Created July 21, 2016 18:38
Show Gist options
  • Save ruxi/6afa0129274c05264ef0bd809e5fbfc4 to your computer and use it in GitHub Desktop.
Save ruxi/6afa0129274c05264ef0bd809e5fbfc4 to your computer and use it in GitHub Desktop.
bash script to make basic conda env
%%writefile make_conda_env.sh
#!/usr/bin/env bash
# author: github.com/ruxi
# reproducibly create conda env
read -p "Create new conda env (y/n)?" CONT
if [ "$CONT" == "n" ]; then
echo "exit";
else
# user chooses to create conda env
# prompt user for conda env name
echo "Creating new conda environment, choose name"
read input_variable
echo "Name $input_variable was chosen";
# Create environment.yml or not
read -p "Create 'enviroment.yml', will overwrite if exist (y/n)?"
if [ "$CONT" == "y" ]; then
# yes: create enviroment.yml
echo "# BASH: conda env create
# source activate phd
name: $input_variable
dependencies:
- python=3
- jupyter
- notebook
- numpy
- rpy2
- pandas
- scipy
- numpy
- scikit-learn
- seaborn
- pip:
- plotly">environment.yml
#list name of packages
conda env create
else
echo "installing base packages"
conda create --name $input_variable\
python=3 jupyter notebook numpy rpy2\
pandas scipy numpy scikit-learn seaborn
fi
echo "to exit: source deactivate"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment