-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
104 lines (86 loc) · 2.92 KB
/
install.sh
File metadata and controls
104 lines (86 loc) · 2.92 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# Exit on any error
set -e
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "Git is not installed. Please install git first."
exit 1
fi
# Check if python3 is installed and version is 3.10 or higher
if ! command -v python3 &> /dev/null; then
echo "Python 3 is not installed. Please install Python 3.10 or higher."
exit 1
elif ! python3 -c "import sys; assert sys.version_info >= (3, 10)" 2>/dev/null; then
echo "Python 3.10 or higher is required. Your version is too old."
exit 1
fi
# Check if Docker is installed and running
if ! command -v docker &> /dev/null; then
echo "Docker is not installed. Please install Docker first."
echo "Visit https://docs.docker.com/get-docker/ for installation instructions."
exit 1
fi
# Check if Docker daemon is running
if ! docker info &> /dev/null; then
echo "Docker daemon is not running. Please start Docker:"
echo "For macOS: Open Docker Desktop application"
echo "For Linux: Run 'sudo systemctl start docker'"
echo "After starting Docker, run this script again."
exit 1
fi
# Clone the repository
echo "Cloning repository..."
git clone https://github.com/mohammad-malik/cpp_dryrun_codegen.git
cd cpp_dryrun_codegen
# Create and activate virtual environment
echo "Creating virtual environment..."
python3 -m venv .venv
source .venv/bin/activate
# Upgrade pip
pip install --upgrade pip
# Install requirements
echo "Installing Python requirements..."
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel setuptools
# Clear pip cache
echo "Clearing pip cache..."
python3 -m pip cache purge
# Upgrade pip and tools
echo "Upgrading pip and tools..."
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel setuptools
# Install requirements in order
echo "Installing packages..."
while IFS= read -r package || [[ -n "$package" ]]; do
if [[ ! $package =~ ^#.* ]] && [[ ! -z "$package" ]]; then
echo "Installing $package..."
python3 -m pip install $package
fi
done < requirements.txt
# Verify installations
echo "Verifying installations..."
python3 -m pip list | grep "google-"
python3 -m pip list | grep "langchain"
# Create required directories
mkdir -p cache logs output
# Create .env file template
if [ ! -f .env ]; then
echo "Creating .env file template..."
echo "GOOGLE_API_KEY=your_api_key_here" > .env
echo "Please edit .env and add your Google API key from https://makersuite.google.com/app/apikey"
fi
# Build Docker image
echo "Building Docker image..."
cd run_cpp
if ! docker build -t cpp-runner .; then
echo "Docker build failed. Please ensure:"
echo "1. Docker daemon is running"
echo "2. You have sufficient permissions"
echo "3. You have internet connection"
exit 1
fi
echo "Installation complete!"
echo "To run the application:"
echo "1. Edit .env and add your Google API key"
echo "2. Ensure Docker daemon is running"
echo "3. Run: run.sh"