forked from AdrienGuille/TOM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython_env_setup.sh
executable file
·58 lines (45 loc) · 1.46 KB
/
python_env_setup.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
#!/usr/bin/env bash
# to manually nuke the current miniconda install
# rm -rf ~/miniconda ~/.condarc ~/.conda ~/.continuum ~/.jupyter ~/.ipython ~/.local/share/jupyter/ ~/Library/Jupyter
# Make a Downloads folder
{
if [ ! -d "$HOME/Downloads" ]; then
mkdir -p "$HOME/Downloads"
fi
}
MC_DIR="miniconda"
MC_DL_FILE="Miniconda3-latest-Linux-x86_64.sh"
MC_DL_PATH="$HOME/Downloads/$MC_DL_FILE"
MC_DIR_PATH="$HOME/$MC_DIR"
# Download Miniconda file only if it does not already exist
{
if [ ! -f "$MC_DL_PATH" ]; then
wget --show-progress -O $MC_DL_PATH https://repo.continuum.io/miniconda/$MC_DL_FILE
fi
}
# install
bash $MC_DL_PATH -b -p $MC_DIR_PATH
# Remove Miniconda file
{
if [ -f "$MC_DL_PATH" ]; then
rm $MC_DL_PATH
fi
}
# enable usage of conda command
echo 'Enabling conda command'
source $HOME/$MC_DIR/etc/profile.d/conda.sh
# add "conda activate" to ~/.bash_profile, enable using it for other envs
echo '' >> ~/.bash_profile
echo '# enable conda activate' >> ~/.bash_profile
echo '. $HOME/'$MC_DIR'/etc/profile.d/conda.sh' >> ~/.bash_profile
echo '# activate the base environment' >> ~/.bash_profile
echo 'conda activate' >> ~/.bash_profile
echo 'Sourcing ~/.bashrc'
source ~/.bashrc
echo 'Running conda activate for base environment'
conda activate
# Install dependencies
echo 'Installing dependencies...'
pip install --trusted-host pypi.python.org --no-cache-dir -r requirements.txt
# Install NLTK stopwords
python -c "import nltk; nltk.download('stopwords')"