-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·42 lines (32 loc) · 1.19 KB
/
install.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
#!/bin/bash
# Function to print error message and exit
print_error_and_exit() {
echo "$1"
echo "Please try deleting the existing 'ga_env' directory and run the script again."
exit 1
}
# Check if Python 3 is found
if ! command -v python3 &> /dev/null; then
print_error_and_exit "Python 3 is not found. Please make sure Python 3 is installed."
fi
# Check if python3-venv package is installed
if ! dpkg -s python3-venv &> /dev/null; then
print_error_and_exit "The 'python3-venv' package is not installed. Please install it using your package manager (e.g., sudo apt-get install python3-venv)."
fi
# Check if virtual environment exists
if [ ! -d "ga_env" ]; then
# Create virtual environment
python3 -m venv ga_env || print_error_and_exit "Failed to create virtual environment"
fi
# Activate virtual environment
source ga_env/bin/activate || print_error_and_exit "Failed to activate virtual environment"
# Upgrade pip
python -m pip install --upgrade pip
# Install ipykernel
pip install ipykernel
# Add kernel spec
python -m ipykernel install --user --name=ga_env
# Install requirements from requirements.txt
pip install -r requirements.txt
# Deactivate virtual environment
deactivate