forked from GATERAGE/DeepSeekRAGE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
73 lines (63 loc) · 2.21 KB
/
install.sh
File metadata and controls
73 lines (63 loc) · 2.21 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# RAGE (c) 2025 Gregory L. Magnusson MIT
# script to automate the creation of the rage venv with min_python_version variable and installation of requirements
# chmod +x install.sh
# ./install.sh
# Minimum required Python version
min_python_version="3.9"
# Find an available Python 3 interpreter
python_interpreter=""
for version in $(seq 11 -1 9); do # Check from 3.11 down to 3.9
if command -v python3."$version" &>/dev/null; then
python_interpreter="python3.$version"
break
fi
done
# If no suitable Python 3 interpreter is found, use 'python3' as a fallback
if [[ -z "$python_interpreter" ]]; then
if command -v python3 &>/dev/null; then
python_interpreter="python3"
else
echo "Error: No suitable Python 3 interpreter found."
exit 1
fi
fi
# Get the Python version
python_version=$("$python_interpreter" --version 2>&1 | awk '{print $2}')
# Check if the Python version meets the minimum requirement
if [[ "$(printf '%s\n%s' "$min_python_version" "$python_version" | sort -V | head -n1)" == "$min_python_version" ]]; then
echo "Using Python interpreter: $python_interpreter ($python_version)"
else
echo "Error: Python version $python_version is below the minimum requirement ($min_python_version)."
exit 1
fi
# Create the virtual environment
"$python_interpreter" -m venv rage
if [[ $? -ne 0 ]]; then
echo "Error: Failed to create virtual environment."
exit 1
fi
# Activate the virtual environment
source rage/bin/activate
if [[ $? -ne 0 ]]; then
echo "Error: Failed to activate virtual environment."
exit 1
fi
# Install dependencies from requirements.txt
pip install -r requirements.txt
if [[ $? -ne 0 ]]; then
echo "Error: Failed to install dependencies from requirements.txt."
exit 1
fi
# Install the package in editable mode (if setup.py or pyproject.toml exists)
if [[ -f setup.py ]] || [[ -f pyproject.toml ]]; then
pip install -e .
if [[ $? -ne 0 ]]; then
echo "Error: Failed to install package in editable mode."
exit 1
fi
echo "Package installed in editable mode."
else
echo "Warning: No setup.py or pyproject.toml found. Skipping editable install."
fi
echo "Virtual environment 'rage' created and activated. Dependencies installed."