-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathsetup_conda.sh
executable file
·51 lines (43 loc) · 1.27 KB
/
setup_conda.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Start from directory of script
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR
# Detect operating system
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
if [ $machine != "Linux" ] && [ $machine != "Mac" ]
then
echo "Conda setup script is only available on Linux and Mac."
exit 1
else
echo "Running on $machine..."
fi
if [[ -z "${CONDA_HOME}" ]]; then
echo "Please specify the CONDA_HOME environment variable (it might look something like ~/miniconda3)."
exit 1
else
echo "Found CONDA_HOME=${CONDA_HOME}."
fi
RECIPE=${RECIPE:-memit}
ENV_NAME="${ENV_NAME:-${RECIPE}}"
echo "Creating conda environment ${ENV_NAME}..."
if [[ ! $(type -P conda) ]]
then
echo "conda not in PATH"
echo "read: https://conda.io/docs/user-guide/install/index.html"
exit 1
fi
if df "${HOME}/.conda" --type=afs > /dev/null 2>&1
then
echo "Not installing: your ~/.conda directory is on AFS."
echo "Use 'ln -s /some/nfs/dir ~/.conda' to avoid using up your AFS quota."
exit 1
fi
# Build new environment
conda env create --name=${ENV_NAME} -f ${RECIPE}.yml