forked from TransformerOptimus/SuperAGI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·54 lines (45 loc) · 1.37 KB
/
run.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
#!/bin/bash
# Check if config.yaml file exists
if [ ! -f "config.yaml" ]; then
echo "ERROR: config.yaml file not found. Please create the config.yaml file."
exit 1
fi
# Function to check if virtual environment is activated
is_venv_activated() {
[[ -n "$VIRTUAL_ENV" ]]
}
# Check if virtual environment is activated
if ! is_venv_activated; then
echo "Virtual environment not activated. Creating and activating virtual environment..."
# Create virtual environment
python3 -m venv venv
# Activate virtual environment based on the operating system
if [[ "$OSTYPE" == "darwin"* ]]; then
source venv/bin/activate
else
source venv/bin/activate
fi
else
echo "Virtual environment is already activated."
fi
# Activate virtual environment
if ! is_venv_activated; then
echo "Activating virtual environment..."
source venv/bin/activate
fi
# Check if requirements are already installed
echo "Checking requirements..."
if ! pip show -r requirements.txt >/dev/null 2>&1; then
echo "Installing requirements..."
pip install -r requirements.txt >/dev/null 2>&1
else
echo "All packages are already installed."
fi
# Run test.py using python
echo "Running test.py with python..."
python test.py
# If the above command fails, run test.py using python3
if [ $? -ne 0 ]; then
echo "Running test.py with python3..."
python3 test.py
fi