forked from microsoft/TRELLIS
-
Notifications
You must be signed in to change notification settings - Fork 7
/
1、install-uv-qinglong.ps1
142 lines (126 loc) · 4.29 KB
/
1、install-uv-qinglong.ps1
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
Set-Location $PSScriptRoot
$Env:HF_HOME = "huggingface"
#$Env:HF_ENDPOINT="https://hf-mirror.com"
$Env:PIP_DISABLE_PIP_VERSION_CHECK = 1
$Env:PIP_NO_CACHE_DIR = 1
#$Env:PIP_INDEX_URL="https://pypi.mirrors.ustc.edu.cn/simple"
#$Env:UV_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple/"
$Env:UV_EXTRA_INDEX_URL = "https://download.pytorch.org/whl/cu124"
$Env:UV_CACHE_DIR = "${env:LOCALAPPDATA}/uv/cache"
$Env:UV_NO_BUILD_ISOLATION = 1
$Env:UV_NO_CACHE = 0
$Env:UV_LINK_MODE = "symlink"
$Env:GIT_LFS_SKIP_SMUDGE = 1
function InstallFail {
Write-Output "Install failed|安装失败。"
Read-Host | Out-Null ;
Exit
}
function Check {
param (
$ErrorInfo
)
if (!($?)) {
Write-Output $ErrorInfo
InstallFail
}
}
# First check if UV cache directory already exists
if (Test-Path -Path "${env:LOCALAPPDATA}/uv/cache") {
Write-Host "UV cache directory already exists, skipping disk space check"
}
else {
# Check C drive free space with error handling
try {
$CDrive = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='C:'" -ErrorAction Stop
if ($CDrive) {
$FreeSpaceGB = [math]::Round($CDrive.FreeSpace / 1GB, 2)
Write-Host "C: drive free space: ${FreeSpaceGB}GB"
# Set UV cache directory based on available space
if ($FreeSpaceGB -lt 10) {
Write-Host "Low disk space detected. Using local .cache directory"
$Env:UV_CACHE_DIR = ".cache"
}
}
else {
Write-Warning "C: drive not found. Using local .cache directory"
$Env:UV_CACHE_DIR = ".cache"
}
}
catch {
Write-Warning "Failed to check disk space: $_. Using local .cache directory"
$Env:UV_CACHE_DIR = ".cache"
}
}
try {
~/.local/bin/uv --version
Write-Output "uv installed|UV模块已安装."
}
catch {
Write-Output "Installing uv|安装uv模块中..."
if ($Env:OS -ilike "*windows*") {
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Check "uv install failed|安装uv模块失败。"
}
else {
sh "./uv-installer.sh"
Check "uv install failed|安装uv模块失败。"
}
}
if ($env:OS -ilike "*windows*") {
if (Test-Path "./venv/Scripts/activate") {
Write-Output "Windows venv"
. ./venv/Scripts/activate
}
elseif (Test-Path "./.venv/Scripts/activate") {
Write-Output "Windows .venv"
. ./.venv/Scripts/activate
}
else {
Write-Output "Create .venv"
~/.local/bin/uv venv -p 3.10
. ./.venv/Scripts/activate
}
}
elseif (Test-Path "./venv/bin/activate") {
Write-Output "Linux venv"
. ./venv/bin/Activate.ps1
}
elseif (Test-Path "./.venv/bin/activate") {
Write-Output "Linux .venv"
. ./.venv/bin/activate.ps1
}
else {
Write-Output "Create .venv"
~/.local/bin/uv venv -p 3.10
. ./.venv/bin/activate.ps1
}
Write-Output "Installing main requirements"
~/.local/bin/uv pip install --upgrade setuptools wheel
~/.local/bin/uv pip sync requirements-uv.txt --index-strategy unsafe-best-match
Check "Install main requirements failed"
try {
~/.local/bin/uv pip install https://github.com/iiiytn1k/sd-webui-some-stuff/releases/download/diffoctreerast/vox2seq-0.0.0-cp310-cp310-win_amd64.whl
}
catch {
~/.local/bin/uv pip install --no-build-isolation -e extensions/vox2seq/
Check "Install vox2seq failed"
}
~/.local/bin/uv pip install kaolin -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.5.1_cu124.html
Check "Install kaolin failed"
try {
~/.local/bin/uv pip install https://github.com/iiiytn1k/sd-webui-some-stuff/releases/download/diffoctreerast/diffoctreerast-0.0.0-cp310-cp310-win_amd64.whl
}
catch {
~/.local/bin/uv pip install --no-build-isolation git+https://github.com/JeffreyXiang/diffoctreerast.git
Check "Install diffoctreerast failed"
}
try {
~/.local/bin/uv pip install https://github.com/sdbds/diff-gaussian-rasterization/releases/download/diff-gaussian-rasterization/diff_gaussian_rasterization-0.0.0-cp310-cp310-win_amd64.whl
}
catch {
~/.local/bin/uv pip install git+https://github.com/sdbds/diff-gaussian-rasterization
Check "Install diff-gaussian-rasterization failed"
}
Write-Output "Install finished"
Read-Host | Out-Null ;