-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·102 lines (84 loc) · 2.9 KB
/
install.sh
File metadata and controls
executable file
·102 lines (84 loc) · 2.9 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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Color codes for better output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
log() {
echo -e "${GREEN}[INFO]${NC} $1"
}
warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
error() {
echo -e "${RED}[ERROR]${NC} $1"
}
log "Starting installation process..."
# 1. Initialize and update submodules
log "Initializing git submodules..."
git submodule update --init --recursive
# 2. Install system dependencies
log "Installing system dependencies (requires sudo)..."
sudo apt update
sudo apt install -y wget cmake g++ libgles2-mesa-dev libglew-dev libglfw3-dev libglm-dev zlib1g-dev libsm6 libglib2.0-0
# 3. Conda environment setup
log "Checking for Conda..."
# Try to find conda
if command -v conda &> /dev/null; then
CONDA_EXE=$(command -v conda)
CONDA_BIN_DIR=$(dirname "$CONDA_EXE")
CONDA_ROOT=$(dirname "$CONDA_BIN_DIR")
elif [ -n "$CONDA_PREFIX" ]; then
CONDA_ROOT=$CONDA_PREFIX
while [ "$(basename "$CONDA_ROOT")" != "miniconda3" ] && [ "$(basename "$CONDA_ROOT")" != "anaconda3" ] && [ "$CONDA_ROOT" != "/" ]; do
CONDA_ROOT=$(dirname "$CONDA_ROOT")
done
fi
if [ -z "$CONDA_ROOT" ] || [ ! -f "$CONDA_ROOT/etc/profile.d/conda.sh" ]; then
# Fallback: check common locations
for loc in "$HOME/miniconda3" "$HOME/anaconda3" "/opt/miniconda3" "/opt/anaconda3"; do
if [ -f "$loc/etc/profile.d/conda.sh" ]; then
CONDA_ROOT=$loc
break
fi
done
fi
if [ -z "$CONDA_ROOT" ] || [ ! -f "$CONDA_ROOT/etc/profile.d/conda.sh" ]; then
error "Conda could not be found or initialized. Please install Miniconda or Anaconda first."
exit 1
fi
log "Using Conda from: $CONDA_ROOT"
source "$CONDA_ROOT/etc/profile.d/conda.sh"
log "Setting up Conda environment 'pcg'..."
if conda info --envs | grep -q "pcg"; then
warn "Conda environment 'pcg' already exists. Activating..."
else
conda create --name pcg python=3.11 -y
fi
conda activate pcg
# 4. Install Infinigen
if [ -d "infinigen" ]; then
log "Installing Infinigen and its dependencies..."
cd infinigen
# Full install (Terrain & OpenGL-GT enabled, needed for Infinigen-Nature HelloWorld)
pip install -e ".[terrain,vis]"
cd ..
else
error "Directory 'infinigen' not found. Did git submodules fail to initialize?"
exit 1
fi
# 5. Install additional requirements
if [ -f "requirements.txt" ] && [ -s "requirements.txt" ]; then
log "Installing additional requirements from requirements.txt..."
pip install -r requirements.txt
else
log "No additional requirements found in requirements.txt, skipping."
fi
log "Installation completed successfully!"
echo -e "
${GREEN}========================================${NC}"
echo -e "To start using the environment, run:"
echo -e " ${YELLOW}conda activate pcg${NC}"
echo -e "${GREEN}========================================${NC}"