-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathsetup_environment.sh
executable file
·64 lines (57 loc) · 1.52 KB
/
setup_environment.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
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
source ~/.bashrc
mac=0
mac_version=0
if [[ "$OSTYPE" =~ ^darwin ]]; then
echo "You use MacOS."
mac=1
number=$(echo "$OSTYPE" | grep -o -E '[0-9]+\.?[0-9]*')
mac_version=${number%%.*}
fi
function program_is_installed {
# set to 1 initially
local return_=1
# set to 0 if not found
type $1 >/dev/null 2>&1 || { local return_=0; }
# return value
echo "$return_"
}
if [ $(program_is_installed conda) == 1 ]; then
echo "Conda installed."
else
echo "Installing Conda."
if [ $mac -eq 1 ]
then
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o miniconda.sh
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh -q
fi
clear
chmod +x miniconda.sh
./miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
echo "## DeepDIVA ##" >> $HOME/.bashrc
echo export PATH="$HOME/miniconda/bin:$PATH" >> $HOME/.bashrc
fi
clear
# Create an environment
if [ $mac -eq 1 ]
then
if [ $mac_version -eq 17 ]
then
conda env create -f environment_mac_17.yml
fi
if [ $mac_version -eq 18 ]
then
conda env create -f environment_mac_18.yml
fi
else
conda env create -f environment.yml
fi
clear
# Set up PYTHONPATH
echo 'export PYTHONPATH=$PWD:$PYTHONPATH' >> $HOME/.bashrc
echo "## DeepDIVA ##" >> $HOME/.bashrc
echo "Setup completed!"
echo "Please run 'source ~/.bashrc' to refresh your environment"
echo "You can activate the deepdiva environment with 'source activate deepdiva'"