forked from filswan/go-computing-provider
-
Notifications
You must be signed in to change notification settings - Fork 25
/
install.sh
executable file
·50 lines (40 loc) · 1.45 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
43
44
45
46
47
48
49
50
#!/bin/bash
# Check Python version and install if necessary
if ! command -v python3 &> /dev/null; then
echo "Installing Python 3..."
sudo apt-get update
sudo apt-get install -y python3
fi
# Check if pip is installed and install if necessary
if ! command -v pip3 &> /dev/null; then
echo "Installing pip..."
sudo apt-get install -y python3-pip
else
echo "pip is installed."
fi
# Check Python version
python_version=$(python3 --version | awk '{print $2}')
required_version="3.8"
if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n 1)" != "$required_version" ]; then
echo "Error: Python version must be greater than or equal to $required_version"
exit 1
else
echo "Python version $python_version is compatible."
fi
# Check if the environment variable is set
if [ -z "$CP_PATH" ]; then
echo "Error: CP_PATH is not set. Please set it using: export CP_PATH=<YOUR CP_PATH>"
exit 1
else
echo "CP_PATH is set to $CP_PATH"
fi
# Check if the directory exists, create if not
if [ ! -d "$CP_PATH/inference-model" ]; then
mkdir -p "$CP_PATH/inference-model"
# Clone the repository and switch to the specified branch
git clone https://github.com/lagrangedao/api-inference-community.git "$CP_PATH/inference-model"
cd "$CP_PATH/inference-model" && git checkout fea-lag-transformer
fi
# Install dependencies
pip3 install -r "$CP_PATH/inference-model/requirements.txt"
echo "Setup completed successfully."