linhaotong commited on
Commit
eef3f27
·
1 Parent(s): b9f87ab
Files changed (2) hide show
  1. DEPENDENCIES_EXPLAINED.md +335 -0
  2. requirements.txt +10 -3
DEPENDENCIES_EXPLAINED.md ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 📦 依赖说明文档
2
+
3
+ ## requirements.txt 完整依赖清单
4
+
5
+ ### ✅ 已包含的所有依赖
6
+
7
+ ---
8
+
9
+ ## 🎨 核心依赖
10
+
11
+ ### PyTorch 相关
12
+ ```txt
13
+ torch>=2.0.0 # 深度学习框架
14
+ torchvision # 计算机视觉工具
15
+ ```
16
+
17
+ **用途:**
18
+ - 模型训练和推理
19
+ - 图像处理
20
+ - GPU 加速
21
+
22
+ **注意:**
23
+ - 会自动安装与 CUDA 兼容的版本
24
+ - Spaces 上会安装预编译的 CUDA 版本
25
+
26
+ ---
27
+
28
+ ## 🖼️ 图像和视频处理
29
+
30
+ ### 图像处理
31
+ ```txt
32
+ opencv-python # OpenCV - 图像处理
33
+ pillow>=9.0 # PIL - 图像读写
34
+ imageio # 多格式图像 I/O
35
+ pillow_heif # HEIF/HEIC 格式支持(苹果照片)
36
+ ```
37
+
38
+ ### 视频处理
39
+ ```txt
40
+ moviepy==1.0.3 # 视频处理和编辑
41
+ ```
42
+
43
+ **用途:**
44
+ - 读取上传的图片和视频
45
+ - 视频帧提取
46
+ - 结果可视化
47
+ - 支持 HEIC 等苹果格式
48
+
49
+ ---
50
+
51
+ ## 🎮 Gradio 和 Spaces
52
+
53
+ ```txt
54
+ gradio>=5.0.0 # Web UI 框架
55
+ spaces # HF Spaces GPU 支持
56
+ ```
57
+
58
+ **用途:**
59
+ - 创建交互式 Web 界面
60
+ - 动态 GPU 分配(@spaces.GPU)
61
+
62
+ **关键:**
63
+ - Gradio 5+ 需要 Python 3.10+
64
+ - `spaces` 是 HF Spaces 专用包
65
+
66
+ ---
67
+
68
+ ## 🎲 3D 可视化
69
+
70
+ ```txt
71
+ trimesh # 3D 网格处理
72
+ open3d # 3D 数据可视化
73
+ plyfile # PLY 格式支持
74
+ ```
75
+
76
+ **用途:**
77
+ - 点云可视化
78
+ - 3D 网格导出(GLB 格式)
79
+ - 相机姿态可视化
80
+
81
+ ---
82
+
83
+ ## 🔢 数学和科学计算
84
+
85
+ ```txt
86
+ numpy<2 # 数值计算(限制 v1.x)
87
+ einops # 张量操作简化
88
+ e3nn # 等变神经网络(3D 几何)
89
+ ```
90
+
91
+ **注意:**
92
+ - `numpy<2` 是因为某些包还不兼容 NumPy 2.0
93
+ - `e3nn` 用于 3D 旋转和几何变换
94
+
95
+ ---
96
+
97
+ ## 🌐 Web 框架(可选)
98
+
99
+ ```txt
100
+ fastapi # 现代 Python Web 框架
101
+ uvicorn # ASGI 服务器
102
+ ```
103
+
104
+ **用途:**
105
+ - 如果需要构建 REST API
106
+ - CLI 工具的后端支持
107
+
108
+ **在 Gradio 应用中:**
109
+ - 通常不需要(Gradio 自带服务器)
110
+ - 但保留以支持 CLI 模式(`da3` 命令)
111
+
112
+ ---
113
+
114
+ ## 🛠️ 工具库
115
+
116
+ ```txt
117
+ requests # HTTP 请求
118
+ omegaconf # 配置文件管理
119
+ typer>=0.9.0 # CLI 框架
120
+ huggingface_hub # HF 模型下载
121
+ safetensors # 安全的模型格式
122
+ evo # 评估工具(轨迹评估)
123
+ ```
124
+
125
+ **用途:**
126
+ - 模型下载(从 HF Hub)
127
+ - 配置文件解析
128
+ - 命令行接口(`da3` 命令)
129
+ - 轨迹评估和可视化
130
+
131
+ ---
132
+
133
+ ## 🌟 3D Gaussian Splatting
134
+
135
+ ```txt
136
+ gsplat @ https://github.com/nerfstudio-project/gsplat/releases/download/v1.5.3/gsplat-1.5.3+pt24cu124-cp310-cp310-linux_x86_64.whl
137
+ ```
138
+
139
+ **⚠️ 重要警告:当前配置问题!**
140
+
141
+ 你的配置使用了 **Python 3.10** 的 wheel (`cp310`),但 README.md 配置的是 **Python 3.11**!
142
+
143
+ **需要修改为对应 Python 3.11 的版本:**
144
+
145
+ ### 选项 1:使用 Python 3.11 的预编译 wheel ⭐
146
+
147
+ ```txt
148
+ # 需要找到或构建 cp311 版本
149
+ gsplat @ https://github.com/nerfstudio-project/gsplat/releases/download/v1.5.3/gsplat-1.5.3+pt24cu124-cp311-cp311-linux_x86_64.whl
150
+ ```
151
+
152
+ ### 选项 2:从源码安装(原方案)
153
+
154
+ ```txt
155
+ gsplat @ git+https://github.com/nerfstudio-project/gsplat.git@0b4dddf04cb687367602c01196913cde6a743d70
156
+ ```
157
+
158
+ ### 选项 3:降级 Python 到 3.10
159
+
160
+ 修改 `README.md`:
161
+ ```yaml
162
+ python_version: 3.10 # 改为 3.10
163
+ ```
164
+
165
+ ---
166
+
167
+ ## ❌ 不包含的依赖(故意排除)
168
+
169
+ ### pre-commit
170
+ ```txt
171
+ # NOT included in requirements.txt
172
+ pre-commit
173
+ ```
174
+
175
+ **原因:**
176
+ - 仅用于开发环境
177
+ - 生产部署不需要
178
+ - 会增加不必要的依赖
179
+
180
+ **如果本地开发需要:**
181
+ ```bash
182
+ pip install pre-commit
183
+ pre-commit install
184
+ ```
185
+
186
+ ### xformers
187
+ ```txt
188
+ # Commented out
189
+ # xformers
190
+ ```
191
+
192
+ **原因:**
193
+ - 可能与某些 CUDA 版本不兼容
194
+ - 构建时间长
195
+ - 不是必需的(可选加速)
196
+
197
+ **如果需要(加速 attention 计算):**
198
+ ```bash
199
+ # 安装后手动添加
200
+ pip install xformers --no-deps
201
+ ```
202
+
203
+ ---
204
+
205
+ ## 📊 依赖统计
206
+
207
+ | 类别 | 数量 | 关键包 |
208
+ |------|------|--------|
209
+ | 核心框架 | 2 | torch, gradio |
210
+ | 图像处理 | 4 | opencv, pillow, imageio |
211
+ | 3D 处理 | 4 | trimesh, open3d, gsplat |
212
+ | 数学计算 | 3 | numpy, einops, e3nn |
213
+ | Web/API | 2 | fastapi, uvicorn |
214
+ | 工具库 | 6 | requests, typer, etc. |
215
+ | **总计** | **21+** | |
216
+
217
+ ---
218
+
219
+ ## 🔍 版本兼容性检查
220
+
221
+ ### Python 版本要求
222
+
223
+ | 包 | 最低 Python | 推荐 Python |
224
+ |----|------------|------------|
225
+ | gradio>=5 | 3.10 | 3.11 ✅ |
226
+ | torch>=2 | 3.8 | 3.11 ✅ |
227
+ | open3d | 3.8 | 3.11 ✅ |
228
+ | gsplat | 3.8 | 3.10/3.11 ⚠️ |
229
+
230
+ ### CUDA 版本要求
231
+
232
+ 当前配置假设:
233
+ - **CUDA 12.4** (`cu124` in gsplat wheel)
234
+ - **PyTorch 2.4** (`pt24` in gsplat wheel)
235
+
236
+ **验证命令:**
237
+ ```python
238
+ import torch
239
+ print(f"PyTorch: {torch.__version__}")
240
+ print(f"CUDA available: {torch.cuda.is_available()}")
241
+ print(f"CUDA version: {torch.version.cuda}")
242
+ ```
243
+
244
+ ---
245
+
246
+ ## 🐛 常见问题
247
+
248
+ ### Q1: gsplat wheel 版本不匹配
249
+
250
+ **错误信息:**
251
+ ```
252
+ ERROR: gsplat-1.5.3+pt24cu124-cp310-cp310-linux_x86_64.whl is not a supported wheel on this platform.
253
+ ```
254
+
255
+ **解决方法:**
256
+ 1. 检查 Python 版本:`python --version`
257
+ 2. 使用匹配的 wheel(cp310 for 3.10, cp311 for 3.11)
258
+ 3. 或者从源码安装
259
+
260
+ ### Q2: numpy 版本冲突
261
+
262
+ **错误信息:**
263
+ ```
264
+ ERROR: package requires numpy<2
265
+ ```
266
+
267
+ **解决方法:**
268
+ - 确保 `numpy<2` 在 requirements.txt 中
269
+ - 某些旧包不支持 NumPy 2.0
270
+
271
+ ### Q3: xformers 构建失败
272
+
273
+ **解决方法:**
274
+ - 保持注释(不安装)
275
+ - 或使用预编译版本:
276
+ ```bash
277
+ pip install xformers==0.0.22 # 匹配你的 PyTorch 版本
278
+ ```
279
+
280
+ ---
281
+
282
+ ## ✅ 完整性检查清单
283
+
284
+ 部署前检查:
285
+
286
+ - [ ] ✅ 所有核心依赖已包含
287
+ - [ ] ✅ Python 版本匹配(3.11)
288
+ - [ ] ⚠️ gsplat wheel 版本匹配 Python 版本
289
+ - [ ] ✅ 不包含开发依赖(pre-commit)
290
+ - [ ] ✅ 可选依赖已注释说明(xformers)
291
+
292
+ ---
293
+
294
+ ## 🔧 本地测试安装
295
+
296
+ ```bash
297
+ # 创建虚拟环境
298
+ python -m venv venv
299
+ source venv/bin/activate # Linux/Mac
300
+ # 或 venv\Scripts\activate # Windows
301
+
302
+ # 安装依赖
303
+ pip install -r requirements.txt
304
+
305
+ # 验证关键包
306
+ python -c "import torch; print('✅ PyTorch:', torch.__version__)"
307
+ python -c "import gradio; print('✅ Gradio:', gradio.__version__)"
308
+ python -c "import trimesh; print('✅ Trimesh OK')"
309
+
310
+ # 尝试导入 gsplat(可能失败如果 wheel 版本不匹配)
311
+ python -c "import gsplat; print('✅ gsplat:', gsplat.__version__)"
312
+ ```
313
+
314
+ ---
315
+
316
+ ## 📝 总结
317
+
318
+ ### 当前配置状态:
319
+
320
+ ✅ **完整性**:所有必需依赖已包含
321
+ ⚠️ **兼容性**:gsplat wheel 需要匹配 Python 3.11
322
+ ✅ **文档**:依赖用途已说明
323
+ ✅ **备用方案**:提供了 requirements-basic.txt
324
+
325
+ ### 建议:
326
+
327
+ 1. **修复 gsplat 版本不匹配**:
328
+ - 选项 A:找 Python 3.11 的 wheel
329
+ - 选项 B:改回从源码安装
330
+ - 选项 C:降级到 Python 3.10
331
+
332
+ 2. **测试完整安装流程**
333
+
334
+ 3. **监控构建日志**
335
+
requirements.txt CHANGED
@@ -10,6 +10,7 @@ opencv-python
10
  gradio>=5.0.0
11
  spaces
12
  pillow>=9.0
 
13
 
14
  # 3D and visualization
15
  trimesh
@@ -30,10 +31,16 @@ e3nn
30
  # Utilities
31
  requests
32
  omegaconf
33
- # xformers - install separately if needed, or use specific version with pre-built wheels
34
- # For PyTorch 2.0+ with CUDA 11.8, use:
 
 
 
 
 
 
35
  # xformers==0.0.22
36
- # Or install after torch with: pip install xformers --no-deps
37
 
38
  # 3D Gaussian Splatting
39
  # Note: This requires CUDA during build. If build fails on Spaces, see alternative solutions.
 
10
  gradio>=5.0.0
11
  spaces
12
  pillow>=9.0
13
+ evo
14
 
15
  # 3D and visualization
16
  trimesh
 
31
  # Utilities
32
  requests
33
  omegaconf
34
+ typer>=0.9.0
35
+
36
+ # Web frameworks (if using API features)
37
+ fastapi
38
+ uvicorn
39
+
40
+ # xformers - commented out due to potential build issues on Spaces
41
+ # If needed, uncomment and use a version compatible with your PyTorch/CUDA:
42
  # xformers==0.0.22
43
+ # Or install after deployment: pip install xformers --no-deps
44
 
45
  # 3D Gaussian Splatting
46
  # Note: This requires CUDA during build. If build fails on Spaces, see alternative solutions.