forked from ace-step/ACE-Step-1.5
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall_uv.sh
More file actions
executable file
·163 lines (149 loc) · 4.21 KB
/
install_uv.sh
File metadata and controls
executable file
·163 lines (149 loc) · 4.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env bash
# Install uv Package Manager
# This script installs uv using the official installer
#
# Usage:
# ./install_uv.sh - Interactive mode (default)
# ./install_uv.sh --silent - Silent mode for script calls
#
# Exit codes:
# 0 - Success (uv installed and available)
# 1 - Installation failed
# 2 - User cancelled (interactive mode only)
set -euo pipefail
SILENT_MODE=0
if [[ "${1:-}" == "--silent" || "${1:-}" == "-s" ]]; then
SILENT_MODE=1
fi
log() {
if [[ "$SILENT_MODE" -eq 0 ]]; then
echo "$@"
fi
}
# Check if uv is already installed
if command -v uv &>/dev/null; then
if [[ "$SILENT_MODE" -eq 1 ]]; then
exit 0
fi
echo "uv is already installed!"
echo "Current version:"
uv --version
echo
echo "Installation location:"
command -v uv
echo
read -rp "Reinstall uv? (Y/N): " REINSTALL
if [[ "${REINSTALL^^}" != "Y" ]]; then
echo
echo "Installation cancelled."
exit 2
fi
echo
fi
log "Installing uv..."
log
# Try the official installer (works on both Linux and macOS)
log "Using official installer (curl)..."
if command -v curl &>/dev/null; then
if [[ "$SILENT_MODE" -eq 1 ]]; then
curl -LsSf https://astral.sh/uv/install.sh 2>/dev/null | sh >/dev/null 2>&1 || true
else
log "Downloading uv installer..."
curl -LsSf https://astral.sh/uv/install.sh | sh || true
fi
elif command -v wget &>/dev/null; then
log "curl not found, trying wget..."
if [[ "$SILENT_MODE" -eq 1 ]]; then
wget -qO- https://astral.sh/uv/install.sh 2>/dev/null | sh >/dev/null 2>&1 || true
else
wget -qO- https://astral.sh/uv/install.sh | sh || true
fi
else
log "========================================"
log "ERROR: Neither curl nor wget found!"
log "========================================"
log
log "Please install curl or wget first:"
log
if [[ "$(uname)" == "Darwin" ]]; then
log " brew install curl"
else
log " Ubuntu/Debian: sudo apt install curl"
log " CentOS/RHEL: sudo yum install curl"
log " Arch: sudo pacman -S curl"
fi
log
exit 1
fi
# Update PATH to include common uv install locations
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
# Verify installation
if command -v uv &>/dev/null; then
log
log "========================================"
log "Installation successful!"
log "========================================"
log
log "uv version:"
log "$(uv --version)"
log
log "Installation location:"
log "$(command -v uv)"
log
log "You can now use ACE-Step by running:"
log " ./start_gradio_ui.sh"
log " ./start_api_server.sh"
if [[ "$(uname)" == "Darwin" ]]; then
log " ./start_gradio_ui_macos.sh (Apple Silicon with MLX)"
log " ./start_api_server_macos.sh (Apple Silicon with MLX)"
fi
log
exit 0
fi
# Check default installation location
if [[ -x "$HOME/.local/bin/uv" ]]; then
log
log "========================================"
log "Installation successful!"
log "========================================"
log
log "Installation location: $HOME/.local/bin/uv"
log
log "NOTE: uv is not in your PATH yet."
log "Add to your shell profile:"
log " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.bashrc"
log " source ~/.bashrc"
log
exit 0
fi
if [[ -x "$HOME/.cargo/bin/uv" ]]; then
log
log "========================================"
log "Installation successful!"
log "========================================"
log
log "Installation location: $HOME/.cargo/bin/uv"
log
log "NOTE: uv is not in your PATH yet."
log "Add to your shell profile:"
log " echo 'export PATH=\"\$HOME/.cargo/bin:\$PATH\"' >> ~/.bashrc"
log " source ~/.bashrc"
log
exit 0
fi
# Installation failed
log
log "========================================"
log "ERROR: Installation failed!"
log "========================================"
log
log "Please install uv manually:"
log
log " curl -LsSf https://astral.sh/uv/install.sh | sh"
log
if [[ "$(uname)" == "Darwin" ]]; then
log "Or using Homebrew:"
log " brew install uv"
fi
log
exit 1