From 6a419f0d1890325c5eb9df6971bac3e9b7b64a6f Mon Sep 17 00:00:00 2001 From: DenisKochetov Date: Mon, 1 Dec 2025 05:32:49 +0000 Subject: [PATCH 1/2] fix lib versions --- README.md | 6 ++--- _Pre_Builds/_Build_Scripts/build_utils.py | 22 +++++++++++------ install.py | 30 +++++++++++++++++++++-- mesh_processor/utils.py | 17 ++++++++++--- requirements.txt | 6 +++-- 5 files changed, 63 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 62f8e80..18af24c 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ This is an extensive node suite that enables ComfyUI to process 3D inputs (Mesh - [Pre-builds](https://github.com/MrForExample/Comfy3D_Pre_Builds) are available for: - Windows 10/11 - Python 3.12 - - CUDA 12.4 - - torch 2.5.1+cu124 + - CUDA 12.8 + - torch 2.7.0+cu128 - [install.py](install.py) will download & install Pre-builds automatically according to your runtime environment, if it couldn't find corresponding Pre-builds, then [build script](_Pre_Builds/_Build_Scripts/auto_build_all.py) will start automatically, if automatic build doesn't work for you, then please check out [Semi-Automatic Build Guide](_Pre_Builds/README.md#build-required-packages-semi-automatically) - If you have any missing node in any open Comfy3D workflow, try simply click [Install Missing Custom Nodes](https://github.com/ltdrdata/ComfyUI-Manager?tab=readme-ov-file#support-of-missing-nodes-installation) in ComfyUI-Manager - In case there is missing python library, you can check [all the python dependencies of my dev environment](my-reqs.txt) @@ -127,7 +127,7 @@ Your ComfyUI Root Directory\python_embeded\python.exe install.py 1. Single image to 3D Mesh shape only 2. 3D Mesh shape + Single reference image to 3D Mesh with RGB texture - Model weights: https://huggingface.co/tencent/Hunyuan3D-2/tree/main - - [Workflows](https://github.com/DenisKochetov/ComfyUI-3D-Pack/tree/dev/example_workflows/Hunyuan3D_V2) + - [Workflows](./example_workflows/Hunyuan3D_V2) diff --git a/_Pre_Builds/_Build_Scripts/build_utils.py b/_Pre_Builds/_Build_Scripts/build_utils.py index 213bb9b..ce43133 100644 --- a/_Pre_Builds/_Build_Scripts/build_utils.py +++ b/_Pre_Builds/_Build_Scripts/build_utils.py @@ -5,13 +5,22 @@ import platform import subprocess import time import glob +import shutil PYTHON_PATH = sys.executable +# Set to False to disable uv usage +ENABLE_UV = True + +def get_pip_install_cmd(args): + if ENABLE_UV and shutil.which("uv"): + return ["uv", "pip", "install", "--python", PYTHON_PATH] + args + return [PYTHON_PATH, "-m", "pip", "install"] + args + try: from omegaconf import OmegaConf except ImportError as e: - subprocess.run([PYTHON_PATH, "-s", "-m", "pip", "install", "OmegaConf"]) + subprocess.run(get_pip_install_cmd(["OmegaConf"])) from omegaconf import OmegaConf BUILD_SCRIPT_ROOT_ABS_PATH = dirname(os.path.abspath(__file__)) @@ -221,10 +230,9 @@ def install_remote_packages(package_names): if hasattr(package_attr, "url"): url_option = package_attr.url_option if hasattr(package_attr, "url_option") else "--index-url" - subprocess.run([ - PYTHON_PATH, "-s", "-m", "pip", "install", + subprocess.run(get_pip_install_cmd([ package_name, url_option, package_attr.url - ]) + ])) continue else: # Check if package is already installed @@ -234,7 +242,7 @@ def install_remote_packages(package_names): print(f"Installing {original_package_name}...") - subprocess.run([PYTHON_PATH, "-s", "-m", "pip", "install", package_name]) + subprocess.run(get_pip_install_cmd([package_name])) def install_platform_packages(): if hasattr(build_config, 'platform_packages') and OS_TYPE in build_config.platform_packages: @@ -248,7 +256,7 @@ def install_platform_packages(): continue print(f"Installing platform package {package}...") - subprocess.run([PYTHON_PATH, "-s", "-m", "pip", "install", package]) + subprocess.run(get_pip_install_cmd([package])) def install_isolated_packages(package_names): """Install packages with special flags like --no-build-isolation""" @@ -265,7 +273,7 @@ def install_isolated_packages(package_names): if hasattr(package_attr, "url"): # Build command with install flags - cmd = [PYTHON_PATH, "-s", "-m", "pip", "install"] + cmd = get_pip_install_cmd([]) if hasattr(package_attr, "install_flags"): cmd.extend(package_attr.install_flags) cmd.append(package_attr.url) diff --git a/install.py b/install.py index 4001332..5bed00b 100644 --- a/install.py +++ b/install.py @@ -24,6 +24,9 @@ try: install_platform_packages, install_isolated_packages, wheels_dir_exists_and_not_empty, + is_package_installed, + get_pip_install_cmd, + ENABLE_UV, build_config, PYTHON_PATH, WHEELS_ROOT_ABS_PATH, @@ -37,6 +40,13 @@ try: except ImportError: subprocess.run([sys.executable, "-m", "pip", "install", "PyGithub"]) + # Install uv if enabled + if ENABLE_UV: + try: + subprocess.run([sys.executable, "-m", "pip", "install", "uv"]) + except Exception: + print("Failed to install uv, continuing with standard pip...") + def install_local_wheels(builds_dir): """Install all wheels from local directory""" wheel_files = glob.glob(os.path.join(builds_dir, "**/*.whl"), recursive=True) @@ -46,7 +56,23 @@ try: success_count = 0 for wheel_path in wheel_files: - result = subprocess.run([PYTHON_PATH, "-s", "-m", "pip", "install", "--no-deps", "--force-reinstall", wheel_path], + # Try to parse package name and version from filename to check if installed + # Wheel filename format: {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl + try: + filename = os.path.basename(wheel_path) + parts = filename.split('-') + package_name = parts[0] + version = parts[1] if len(parts) > 1 else None + + # Check if installed (check both raw name and normalized name with dashes) + if is_package_installed(package_name, version) or is_package_installed(package_name.replace('_', '-'), version): + cstr(f"Wheel {filename} is already installed, skipping...").msg.print() + success_count += 1 + continue + except Exception: + pass + + result = subprocess.run(get_pip_install_cmd(["--no-deps", wheel_path]), text=True, capture_output=True) if result.returncode == 0: cstr(f"Successfully installed wheel: {os.path.basename(wheel_path)}").msg.print() @@ -125,7 +151,7 @@ try: except ImportError: cstr(f"Installing {tool}...").msg.print() result = subprocess.run( - [PYTHON_PATH, "-m", "pip", "install", "--upgrade", tool], + get_pip_install_cmd(["--upgrade", tool]), text=True, capture_output=True ) if result.returncode != 0: diff --git a/mesh_processor/utils.py b/mesh_processor/utils.py index e941418..87b7d67 100644 --- a/mesh_processor/utils.py +++ b/mesh_processor/utils.py @@ -23,12 +23,21 @@ def ensure_little_endian(array: np.ndarray, dtype: Optional[np.dtype] = None) -> """Return an array with little-endian dtype (copy if needed).""" if dtype is not None: array = array.astype(dtype, copy=False) - if array.dtype.byteorder in (">", "|"): - return array.byteswap().newbyteorder("<") + + # Big-endian → Little-endian + if array.dtype.byteorder == ">": + return array.byteswap().view(array.dtype.newbyteorder("<")) + + # "|" = non-byte-order type → treat as big-endian-compatible + if array.dtype.byteorder == "|": + return array.view(array.dtype.newbyteorder("<")) + + # Already little-endian if array.dtype.byteorder == "<": return array - # native without explicit endianness - return array.astype(array.dtype.newbyteorder("<"), copy=False) + + # Native ("=") without explicit endianness → convert explicitly + return array.view(array.dtype.newbyteorder("<")) def as_uint8_buffer(array: np.ndarray) -> np.ndarray: diff --git a/requirements.txt b/requirements.txt index 06c328d..27b7089 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ PyGithub requests # computational libraries -numpy +numpy>=2.2.6 einops scipy kornia @@ -23,6 +23,8 @@ git+https://github.com/EasternJournalist/utils3d.git#egg=utils3d git+https://github.com/ashawkey/kiuikit.git#egg=kiui # for use ML models +hf_transfer +peft==0.17.1 diffusers==0.31.0 transformers==4.46.2 safetensors @@ -50,7 +52,7 @@ plyfile pygltflib xatlas pymeshlab -gpytoolbox +gpytoolbox==0.3.7 PyMCubes libigl pyvista From c480cf563d01d62c9187931239be964c27da6648 Mon Sep 17 00:00:00 2001 From: DenisKochetov Date: Mon, 1 Dec 2025 15:12:29 +0800 Subject: [PATCH 2/2] add comfy reqs --- requirements.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/requirements.txt b/requirements.txt index 27b7089..6e6c9bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -69,3 +69,15 @@ OmegaConf pyhocon iopath easydict + +# comfyui +comfyui-workflow-templates +comfyui-embedded-docs +torchsde +sentencepiece +alembic +SQLAlchemy +av>=14.2.0 +spandrel +pydantic~=2.0 +pydantic-settings~=2.0 \ No newline at end of file