import os import subprocess import sys def run_setup(directory): try: os.chdir(directory) result = subprocess.run([sys.executable, "setup.py", "install"], check=True, capture_output=True, text=True) print(f"Successfully installed {directory}: {result.stdout}") except subprocess.CalledProcessError as e: print(f"Error installing {directory}: {e.stderr}") except Exception as e: print(f"Unexpected error in {directory}: {e}") # Install custom_rasterizer run_setup("hy3dgen/texgen/custom_rasterizer") # Install differentiable_renderer run_setup("hy3dgen/texgen/differentiable_renderer") # Download Real-ESRGAN model try: os.makedirs("hy3dpaint/ckpt", exist_ok=True) realesrgan_url = "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth" subprocess.run(["wget", realesrgan_url, "-P", "hy3dpaint/ckpt"], check=True, capture_output=True, text=True) print("Successfully downloaded Real-ESRGAN model") except Exception as e: print(f"Error downloading Real-ESRGAN: {e}")