-
Notifications
You must be signed in to change notification settings - Fork 0
/
initialize_env.sh
26 lines (20 loc) · 959 Bytes
/
initialize_env.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
#!/bin/bash
# Define variables
VENV_DIR=".venv"
SPACY_PACKAGE="spacy"
SPACY_MODEL="en_core_web_lg"
# Check if the virtual environment directory exists
if [ -d "$VENV_DIR" ]; then
echo "$VENV_DIR directory already exists. Skipping virtual environment creation."
else
# Create a virtual environment if it does not exist
python -m venv $VENV_DIR || { echo "Failed to create virtual environment"; exit 1; }
fi
# Activate the virtual environment
source $VENV_DIR/bin/activate || { echo "Failed to activate virtual environment"; exit 1; }
# Install dependencies from requirements.txt
pip install -r requirements.txt || { echo "Failed to install dependencies from requirements.txt"; exit 1; }
# Upgrade spacy to the latest version
pip install -U $SPACY_PACKAGE || { echo "Failed to upgrade $SPACY_PACKAGE"; exit 1; }
# Download the spacy model
python -m spacy download $SPACY_MODEL || { echo "Failed to download spacy model $SPACY_MODEL"; exit 1; }