| title | ComfyUI SAM3D Docker Setup | |||||
|---|---|---|---|---|---|---|
| description | Documentation for comfyui-sam3d-setup | |||||
| category | how-to | |||||
| tags |
|
|||||
| related-docs |
|
|||||
| updated-date | 2025-12-18 | |||||
| difficulty-level | advanced | |||||
| dependencies |
|
ComfyUI container with SAM3D (Segment Anything 3D) nodes pre-configured for 3D object generation from images.
Location: agentbox/comfyui/ (migrated from legacy multi-agent-docker/comfyui/)
cd agentbox/comfyui
docker compose -f docker-compose.comfyui.yml up -dWeb UI: http://localhost:8188
- Base image:
yanwk/comfyui-boot:cu130-slim(Python 3.13, PyTorch 2.9.1+cu130) - SAM3D venv: Isolated Python 3.10 environment with PyTorch 2.4.1+cu124
- GPU: NVIDIA RTX A6000 (48GB VRAM)
SAM3D requires PyTorch 2.4.x with specific CUDA libraries. The main ComfyUI runs on Python 3.13/PyTorch 2.9.1. The isolated venv prevents conflicts.
Problem: Official Facebook PyTorch3D wheels at dl.fbaipublicfiles.com return 403 Forbidden.
Fix: Use third-party prebuilt wheels from miropsota:
RUN uv pip install --python ./_env/bin/python \
pytorch3d==0.7.9+pt2.4.1cu124 \
--extra-index-url https://miropsota.github.io/torch_packages_builderProblem: SAM3D requires spconv for sparse 3D convolutions.
Fix: Install spconv-cu124 before other dependencies:
RUN uv pip install --python ./_env/bin/python \
"spconv-cu124>=2.3.8"Problem: sam2 pulls torch 2.9.x, breaking pytorch3d compatibility.
Fix: Removed sam2 from dependencies. SAM3D works without it. If sam2 is needed, reinstall pinned torch after:
RUN uv pip install --python ./_env/bin/python \
torch==2.4.1 torchvision==0.19.1 \
--index-url https://download.pytorch.org/whl/cu124 --reinstallProblem: SAM3D worker subprocess can't find CUDA libs (cublasLtCreate error).
Fix: Patch subprocess_bridge.py to set LD_LIBRARY_PATH with nvidia lib paths from the venv. Applied automatically at build time.
Problem: SAM3D inference worker imports loguru but it's not in requirements.
Fix: Add loguru to the pip install list.
| Host Path | Container Path | Purpose |
|---|---|---|
./storage-models |
/root/ComfyUI/models |
Model weights |
./storage-output |
/root/ComfyUI/output |
Generated files |
./storage-input |
/root/ComfyUI/input |
Input images |
comfyui-custom-nodes (volume) |
/root/ComfyUI/custom_nodes |
Extensions |
Located at ./storage-models/sam3d/hf/checkpoints/:
ss_generator.ckpt(6.3GB) - Sparse structure generatorslat_generator.ckpt(4.6GB) - SLAT latent generatorslat_decoder_mesh.ckpt(347MB) - Mesh decoderslat_decoder_gs.ckpt(164MB) - Gaussian splatting decoderpipeline.yaml- Pipeline config
Pipeline (in order):
LoadSAM3DModel- Load model (tag:hf)SAM3D_DepthEstimate- Depth estimation (~2s)SAM3DSparseGen- Sparse structure (~3s)SAM3DSLATGen- SLAT generation (~60s)SAM3DGaussianDecodeorSAM3DMeshDecode(~15s)SAM3DTextureBake- Optional texture baking (~30-60s)
Export: SAM3DExportPLY, SAM3DExportMesh
Check for conflicting custom nodes in the volume:
docker volume rm comfyui_comfyui-custom-nodes
docker compose -f docker-compose.comfyui.yml up -dSet use_gpu_cache: False in LoadSAM3DModel node.
docker logs comfyui --tail 100- Joins
visionclaw_networknetwork - Aliases:
comfyui.ragflow,comfyui.local - External access:
192.168.0.51:8188
The ComfyUI MCP server enables Claude to interact with workflows programmatically.
Located at skills/comfyui/mcp-server/ with config in mcp-infrastructure/mcp.json:
{
"comfyui": {
"command": "node",
"args": ["/home/devuser/.claude/skills/comfyui/mcp-server/server.js"],
"env": {
"COMFYUI_URL": "http://192.168.0.51:8188",
"COMFYUI_WS_URL": "ws://192.168.0.51:8188/ws",
"ZAI_URL": "http://localhost:9600/chat"
}
}
}| Tool | Description |
|---|---|
workflow_submit |
Submit ComfyUI workflow JSON |
workflow_status |
Check job status by ID |
workflow_cancel |
Cancel running job |
model_list |
List available models |
image_generate |
Text2img with FLUX |
display_capture |
Screenshot X display |
output_list |
List generated outputs |
chat_workflow |
Natural language → workflow (via Z.AI) |
cd skills/comfyui/mcp-server
npm installRequires: @modelcontextprotocol/sdk, ws, sharp