remove cpu support

This commit is contained in:
pythongosssss 2026-01-28 20:58:04 -08:00
parent a4317314d2
commit d809ef8fb1

View File

@ -1,12 +1,5 @@
import os import os
from comfy.cli_args import args
if args.cpu:
os.environ.setdefault("PYOPENGL_PLATFORM", "osmesa")
elif not os.environ.get("DISPLAY") and not os.environ.get("WAYLAND_DISPLAY"):
os.environ.setdefault("PYOPENGL_PLATFORM", "egl")
import re import re
import logging import logging
from typing import TypedDict from typing import TypedDict
@ -30,29 +23,14 @@ except ImportError as e:
"Install with: pip install PyOpenGL PyOpenGL-accelerate glfw" "Install with: pip install PyOpenGL PyOpenGL-accelerate glfw"
) from e ) from e
except AttributeError as e: except AttributeError as e:
# This happens when PyOpenGL can't load the requested platform (e.g., OSMesa not installed) # This happens when PyOpenGL can't initialize (e.g., no display, missing libraries)
platform = os.environ.get("PYOPENGL_PLATFORM", "default") raise RuntimeError(
if platform == "osmesa": "OpenGL initialization failed.\n"
raise RuntimeError( "Ensure OpenGL drivers are installed and a display is available.\n\n"
"OSMesa (software rendering) requested but not installed.\n" "For headless servers, you may need:\n"
"OSMesa is required for --cpu mode.\n\n" " - EGL: sudo apt install libegl1-mesa-dev\n"
"Install OSMesa:\n" " - Or a virtual display: Xvfb :99 & export DISPLAY=:99"
" e.g. Ubuntu/Debian: sudo apt install libosmesa6-dev\n" ) from e
"Or disable CPU mode to use hardware rendering."
) from e
elif platform == "egl":
raise RuntimeError(
"EGL (headless rendering) requested but not available.\n"
"EGL is used for headless GPU rendering without a display.\n\n"
"Install EGL:\n"
" e.g. Ubuntu/Debian: sudo apt install libegl1-mesa-dev libgles2-mesa-dev\n"
"Or set DISPLAY/WAYLAND_DISPLAY environment variable if you have a display."
) from e
else:
raise RuntimeError(
f"OpenGL initialization failed (platform: {platform}).\n"
"Ensure OpenGL drivers are installed and working."
) from e
class SizeModeInput(TypedDict): class SizeModeInput(TypedDict):