-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRUN_VENV.sh
executable file
·38 lines (33 loc) · 928 Bytes
/
RUN_VENV.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
#!/bin/bash
## Run (and initialize) the virtual environment for the project.
## It uses conda. Alternatively you may outcomment the python/pip commands.
ENV=env_ranker
DIR=`pwd`
REQ="$DIR/requirements.txt"
## Set up virtual environment (dependency: conda)
# if [ -f "$REQ" ];
# then
# conda create --name $ENV --file $REQ
## python -m venv $ENV
## python -m pip install -r requirements.txt
# else
# conda create -n $ENV python=3.9.5
## python -m venv $ENV
# fi
## Activate v. env.
source ~/anaconda3/etc/profile.d/conda.sh
conda activate $ENV
echo "Copy the following line to start virtual environment:"
echo "conda activate $ENV"
# echo "source $ENV/bin/activate"
## Store dependencies
if [ -f "$REQ" ];
then
echo "$REQ exists."
else
conda list --explicit > "$REQ"
# pip freeze > requirements.txt
fi
## Deactivate the environment to avoid background processes.
conda deactivate
# deactivate