Skip to content

Instantly share code, notes, and snippets.

@ruxi
Created July 21, 2016 18:38
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save ruxi/949e3d326c5a8a24ecffa8a225b2be2a to your computer and use it in GitHub Desktop.
Save ruxi/949e3d326c5a8a24ecffa8a225b2be2a 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