Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: eglInitialize failed (0x3001) #8

Closed
O-O1024 opened this issue Oct 8, 2024 · 8 comments
Closed

Exception: eglInitialize failed (0x3001) #8

O-O1024 opened this issue Oct 8, 2024 · 8 comments

Comments

@O-O1024
Copy link

O-O1024 commented Oct 8, 2024

I don't know how to solve it.

libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)

!!! Exception during processing !!! eglInitialize failed (0x3001)
Traceback (most recent call last):
  File "/root/ComfyUI/execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "/root/ComfyUI/execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "/root/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "/root/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "/root/ComfyUI/custom_nodes/ComfyUI-Depthflow-Nodes/src/depthflow.py", line 207, in apply_depthflow
    scene = CustomDepthflowScene(
  File "/root/ComfyUI/custom_nodes/ComfyUI-Depthflow-Nodes/src/depthflow.py", line 12, in __init__
    DepthScene.__init__(self, **kwargs)
  File "<attrs generated init DepthFlow.Scene.DepthScene>", line 98, in __init__
    self.__attrs_post_init__()
  File "/root/miniconda3/lib/python3.10/site-packages/Broken/Core/BrokenUtils.py", line 80, in __attrs_post_init__
    method(self)
  File "/root/miniconda3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 119, in __post__
    self.build()
  File "/root/miniconda3/lib/python3.10/site-packages/DepthFlow/Scene.py", line 126, in build
    ShaderScene.build(self)
  File "/root/miniconda3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 139, in build
    self.init_window()
  File "/root/miniconda3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 533, in init_window
    self.window = importlib.import_module(module).Window(
  File "/root/miniconda3/lib/python3.10/site-packages/moderngl_window/context/headless/window.py", line 25, in __init__
    self.init_mgl_context()
  File "/root/miniconda3/lib/python3.10/site-packages/moderngl_window/context/headless/window.py", line 36, in init_mgl_context
    self._ctx = moderngl.create_standalone_context(
  File "/root/miniconda3/lib/python3.10/site-packages/moderngl/__init__.py", line 1986, in create_standalone_context
    return create_context(standalone=True, **kwargs)
  File "/root/miniconda3/lib/python3.10/site-packages/moderngl/__init__.py", line 1936, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/root/miniconda3/lib/python3.10/site-packages/glcontext/__init__.py", line 120, in create
    return egl.create_context(**kwargs)
Exception: eglInitialize failed (0x3001)
@akatz-ai
Copy link
Owner

akatz-ai commented Oct 9, 2024

Hi @O-O1024, where are you running ComfyUI in this case? Locally or in the cloud? Others have experienced issues running this nodepack on Runpod due to not having OpenGL acceleration available which will cause the same error message above.

@O-O1024
Copy link
Author

O-O1024 commented Oct 9, 2024

Hi @O-O1024, where are you running ComfyUI in this case? Locally or in the cloud? Others have experienced issues running this nodepack on Runpod due to not having OpenGL acceleration available which will cause the same error message above.

I running it in the cloud with ssh tool.

@Tremeschin
Copy link

@O-O1024 It's definitely a driver installation issue (or the lack of) in the host server and/or docker image you're running

It's certainly possible to run it on the cloud, for example this Google Colab notebook (slow, no gl accel), or modal.com script file I made, and also this community member that got it running on Inferless (apparently worked? #notsponsored)

  • Note: I've got a semi-complete write up on what needs to happen to have OpenGL acceleration as akatz said on my documentation, at least for running a docker image locally, but it also applies for cloud providers

EGL is used for headless rendering without the use of a video server (X11/Wayland on Linux). If you want to disable it, set WINDOW_EGL=0, it'll probably try using GLX for context creation and might fail without one, in which case installing xvfb and prepending the command with xvfb-run might work but it'll use CPU rendering only (very slow)

If you have the option to modify or start off a custom docker image in your provider, then you're maybe in luck to get GPU acceleration, otherwise speeds will be as bad as a couple seconds per frame as seen in colab. The most important thing; the host system must have the graphics capability enabled on NVIDIA Container Toolkit, which is out of user controls

The general idea is to start with the nvidia/opengl:1.2-glvnd-runtime-ubuntu22.04 image for glvnd to actually find GPUs on the system, or if you're doing just CPU rendering to install some Ubuntu packages like libegl1-mesa libegl1-mesa-dev which should get llvmpipe (seen in colab) to pop up as a GL-capable devide (that's cpu rendering, slow)

There'll probably be quirks on each provider, for example, in modal one needs to ask their support team to move the workspace to their older runner which supports the graphics settings

I know talk is cheap, but without knowing what exact provider or hardware you're trying to run, it's hard to pin down to something specific, so I mainly linked resources and TLDR it here :)

But ultimately, you're missing any of libEGL.so in /usr/lib/libEGL* !

Let us know if any of this works! 🙂

@Tremeschin
Copy link

Tremeschin commented Oct 13, 2024

I investigated this today; starting off a local docker images with runpod/pytorch:2.2.0-py3.10-cuda12.1.1-devel-ubuntu22.04 (that one might use in runpod) indeed fails with libEGL not found or initialization errors

After investigating what magic nvidia/opengl:1.2-glvnd-runtime-ubuntu22.04 does and trying out a lot of things, I discovered that to get libglvnd running outside nvidia's image, we just need to do:

# (Ubuntu 22.04)
RUN apt update && apt install -y libegl1-mesa libglvnd-dev libglvnd0
RUN mkdir -p /usr/share/glvnd/egl_vendor.d
RUN echo '{"file_format_version":"1.0.0","ICD":{"library_path":"/usr/lib/x86_64-linux-gnu/libEGL_nvidia.so.0"}}' > /usr/share/glvnd/egl_vendor.d/10_nvidia.json

# Could also be important
ENV NVIDIA_DRIVER_CAPABILITIES="all"
ENV NVIDIA_VISIBLE_DEVICES="all"

All three packages were required for my RTX 3060 to pop up as a OpenGL renderer, and the ICD file is needed to list the nvidia as a EGL capable device; you can modify or run these commands on a base image in runpod or similar providers, or connect via SSH or remote VNC access to execute the commands directly!

Note: The provider must enable graphics capabilities on NCT on the host for OpenGL to work, hope they do or ask their support!

let us know if this works for whatever provider you might be running!

@Tremeschin
Copy link

⭐️ Big news, what I said on my previous comment seems to work for runpod!

Community member screenshot:

image

So yea, installing the three packages and the icd file did the trick! We now have a cloud provider with OpenGL acceleration working, without needing to ask their support team, with only minor intervention needed 🙂

@akatz-ai
Copy link
Owner

Closing this as it appears to be fixed based on the docker code provided in the mentioned issue above.

@killy001
Copy link

2024-12-25T07:16:12.116290 - Prompt executed in 2.25 seconds 2024-12-25T07:17:24.201205 - got prompt 2024-12-25T07:17:24.254405 - │DepthFlow├┤1'22.937├┤INFO │ ▸ (Module 2 • CustomDepthf) Initializing scene 'CustomDepthflowScene' with backend headless 2024-12-25T07:17:24.264139 - !!! Exception during processing !!! eglGetPlatformDisplayEXT failed (0x3000) 2024-12-25T07:17:24.264436 - Traceback (most recent call last): File "/app/ComfyUI/execution.py", line 323, in execute output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "/app/ComfyUI/execution.py", line 198, in get_output_data return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "/app/ComfyUI/execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "/app/ComfyUI/execution.py", line 158, in process_inputs results.append(getattr(obj, func)(**inputs)) File "/app/ComfyUI/custom_nodes/ComfyUI-Depthflow-Nodes/src/depthflow.py", line 293, in apply_depthflow scene = CustomDepthflowScene( File "/app/ComfyUI/custom_nodes/ComfyUI-Depthflow-Nodes/src/depthflow.py", line 59, in __init__ DepthScene.__init__(self, **kwargs) File "<attrs generated init DepthFlow.Scene.DepthScene>", line 101, in __init__ self.__attrs_post_init__() File "/usr/local/python3/lib/python3.10/site-packages/Broken/Core/__init__.py", line 504, in __attrs_post_init__ method(self) File "/usr/local/python3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 120, in __post__ self._build() File "/usr/local/python3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 138, in _build self.init_window() File "/usr/local/python3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 495, in init_window self.window = importlib.import_module(module).Window( File "/usr/local/python3/lib/python3.10/site-packages/moderngl_window/context/headless/window.py", line 25, in __init__ self.init_mgl_context() File "/usr/local/python3/lib/python3.10/site-packages/moderngl_window/context/headless/window.py", line 36, in init_mgl_context self._ctx = moderngl.create_standalone_context( File "/usr/local/python3/lib/python3.10/site-packages/moderngl/__init__.py", line 2304, in create_standalone_context return create_context(standalone=True, **kwargs) File "/usr/local/python3/lib/python3.10/site-packages/moderngl/__init__.py", line 2254, in create_context ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings) File "/usr/local/python3/lib/python3.10/site-packages/glcontext/__init__.py", line 120, in create return egl.create_context(**kwargs) Exception: eglGetPlatformDisplayEXT failed (0x3000)

@killy001
Copy link

2024-12-25T07:16:12.116290 - Prompt executed in 2.25 seconds
2024-12-25T07:17:24.201205 - got prompt
2024-12-25T07:17:24.254405 - │DepthFlow├┤1'22.937├┤INFO   │ ▸ (Module  2 • CustomDepthf) Initializing scene 'CustomDepthflowScene' with backend headless
2024-12-25T07:17:24.264139 - !!! Exception during processing !!! eglGetPlatformDisplayEXT failed (0x3000)
2024-12-25T07:17:24.264436 - Traceback (most recent call last):
  File "/app/ComfyUI/execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "/app/ComfyUI/execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "/app/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "/app/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "/app/ComfyUI/custom_nodes/ComfyUI-Depthflow-Nodes/src/depthflow.py", line 293, in apply_depthflow
    scene = CustomDepthflowScene(
  File "/app/ComfyUI/custom_nodes/ComfyUI-Depthflow-Nodes/src/depthflow.py", line 59, in __init__
    DepthScene.__init__(self, **kwargs)
  File "<attrs generated init DepthFlow.Scene.DepthScene>", line 101, in __init__
    self.__attrs_post_init__()
  File "/usr/local/python3/lib/python3.10/site-packages/Broken/Core/__init__.py", line 504, in __attrs_post_init__
    method(self)
  File "/usr/local/python3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 120, in __post__
    self._build()
  File "/usr/local/python3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 138, in _build
    self.init_window()
  File "/usr/local/python3/lib/python3.10/site-packages/ShaderFlow/Scene.py", line 495, in init_window
    self.window = importlib.import_module(module).Window(
  File "/usr/local/python3/lib/python3.10/site-packages/moderngl_window/context/headless/window.py", line 25, in __init__
    self.init_mgl_context()
  File "/usr/local/python3/lib/python3.10/site-packages/moderngl_window/context/headless/window.py", line 36, in init_mgl_context
    self._ctx = moderngl.create_standalone_context(
  File "/usr/local/python3/lib/python3.10/site-packages/moderngl/__init__.py", line 2304, in create_standalone_context
    return create_context(standalone=True, **kwargs)
  File "/usr/local/python3/lib/python3.10/site-packages/moderngl/__init__.py", line 2254, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/usr/local/python3/lib/python3.10/site-packages/glcontext/__init__.py", line 120, in create
    return egl.create_context(**kwargs)
Exception: eglGetPlatformDisplayEXT failed (0x3000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants