forked from DIVA-DIA/DeepDIVA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_environment.sh
executable file
·58 lines (51 loc) · 1.5 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
#!/bin/bash
source ~/.bashrc
# Verify Conda installation: (https://conda.io/docs/user-guide/install/index.html)
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
mac=0
if [[ "$OSTYPE" =~ ^darwin ]]; then
echo "You use MacOS."
mac=1
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"
echo 'source ~/.bash_functions' >> ~/.bashrc
else
echo "installing conda"
if [ $mac -eq 1 ]
then
curl https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -output Miniconda2-latest-MacOSX-x86_64.sh
chmod +x Miniconda2-latest-MacOSX-x86_64.sh
./Miniconda2-latest-MacOSX-x86_64.sh
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
fi
tail -n 1 ~/.bashrc >> ~/.bash_functions
head -n -2 ~/.bashrc
echo 'source ~/.bash_functions' >> ~/.bashrc
source ~/.bash_functions
fi
# Create an environment
if [ $mac -eq 1 ]
then
conda env create -f environment_mac.yml
else
conda env create -f environment.yml
fi
# Set up PYTHONPATH
touch ~/.bash_functions
echo 'export PYTHONPATH=$PWD:$PYTHONPATH' >> ~/.bash_functions
# Congratulate user on success
echo "You're the best! Everything worked!"