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

OpenGL EGLError - EGL_NOT_INITIALIZED #3

Closed
jxxtin opened this issue Jan 26, 2025 · 7 comments
Closed

OpenGL EGLError - EGL_NOT_INITIALIZED #3

jxxtin opened this issue Jan 26, 2025 · 7 comments

Comments

@jxxtin
Copy link

jxxtin commented Jan 26, 2025

Hello, @pointW

I am running a training script on a headless Ubuntu server, and I encounter the following OpenGL error during the validation phase:

OpenGL.raw.EGL._errors.EGLError: EGLError(
        err = EGL_NOT_INITIALIZED,
        baseOperation = eglDestroyContext,
        cArguments = (
                <OpenGL._opaque.EGLDisplay_pointer object at 0x7f440c46ebc0>,
                <OpenGL._opaque.EGLContext_pointer object at 0x7f4360c6f840>,
        ),
        result = 0
)

Could you provide guidance on how to properly resolve this issue?

@pointW
Copy link
Owner

pointW commented Jan 26, 2025

Hi @jxxtin, did you install all of the required packages for mujoco? What version of Ubuntu are you running on?

One solution could be running with osmesa instead:

# to train with batch size of 64 and hidden dimension of 64
MUJOCO_GL=osmesa PYOPENGL_PLATTFORM=osmesa python train.py --config-name=train_equi_diffusion_unet_abs task_name=stack_d1 policy.enc_n_hidden=64 dataloader.batch_size=64

You can also check whether your code is using spawn for multi-processing:

mp.set_start_method('spawn', force=True)
I have seen some similar error without using spawn

@jxxtin
Copy link
Author

jxxtin commented Jan 27, 2025

hello @pointW

My environment setup is as follows:

Ubuntu 22.04.3  
Mujoco 2.3.2  

I have also checked that spawn is working.

When running the code you suggested, I encountered the following error:

Image

Would you be able to help me identify what I might be doing wrong?

Thanks for your help!

@pointW
Copy link
Owner

pointW commented Feb 6, 2025

Hmm, that's weird, could you add HYDRA_FULL_ERROR=1 and show me the full error message?

@jxxtin
Copy link
Author

jxxtin commented Feb 6, 2025

Hellow @pointW,

After exporting HYDRA_FULL_ERROR=1, when running the following command:

MUJOCO_GL=osmesa PYOPENGL_PLATFORM=osmesa python train.py --config-name=train_equi_diffusion_unet_abs task_name=stack_d1 policy.enc_n_hidden=64 dataloader.batch_size=64

I encountered the following error.

equidiff git:(main) ✗ MUJOCO_GL=osmesa PYOPENGL_PLATTFORM=osmesa python train.py --config-name=train_equi_diffusion_unet_abs task_name=stack_d1
ROBOMIMIC WARNING(
    No private macro file found!
    It is recommended to use a private macro file
    To setup, run: python /root/miniforge3/envs/equidiff/lib/python3.9/site-packages/robomimic/scripts/setup_macros.py
)
[2025-02-06 13:46:54,441][equi_diffpo.model.diffusion.conditional_unet1d][INFO] - number of parameters: 2.552895e+08
Enc params: 1.588464e+07
Diff params: 2.552909e+08
Acquiring lock on cache.
Loading cached ReplayBuffer from Disk.
Loaded!
[robosuite WARNING] No private macro file found! (macros.py:53)
[2025-02-06 13:46:59,409][robosuite_logs][WARNING] - No private macro file found!
[robosuite WARNING] It is recommended to use a private macro file (macros.py:54)
[2025-02-06 13:46:59,409][robosuite_logs][WARNING] - It is recommended to use a private macro file
[robosuite WARNING] To setup, run: python /root/miniforge3/envs/equidiff/lib/python3.9/site-packages/robosuite/scripts/setup_macros.py (macros.py:55)
[2025-02-06 13:46:59,409][robosuite_logs][WARNING] - To setup, run: python /root/miniforge3/envs/equidiff/lib/python3.9/site-packages/robosuite/scripts/setup_macros.py
Error executing job with overrides: ['task_name=stack_d1']

    from mujoco.gl_context import *
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/mujoco/gl_context.py", line 38, in <module>
    from mujoco.osmesa import GLContext as _GLContext
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/mujoco/osmesa/__init__.py", line 24, in <module>
    raise ImportError(
ImportError: Cannot use OSMesa rendering platform. The PYOPENGL_PLATFORM environment variable is set to 'egl' (should be either unset or 'osmesa').

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 134, in _resolve_target
    target = _locate(target)
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/_internal/utils.py", line 653, in _locate
    raise ImportError(
ImportError: Error loading 'equi_diffpo.env_runner.robomimic_image_runner.RobomimicImageRunner':
ImportError("Cannot use OSMesa rendering platform. The PYOPENGL_PLATFORM environment variable is set to 'egl' (should be either unset or 'osmesa').")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/projects/equidiff/train.py", line 78, in <module>
    main()
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/main.py", line 90, in decorated_main
    _run_hydra(
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/_internal/utils.py", line 389, in _run_hydra
    _run_app(
    lambda: hydra.run(
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/root/projects/equidiff/train.py", line 75, in main
    workspace.run()
  File "/root/projects/equidiff/equi_diffpo/workspace/train_equi_workspace.py", line 113, in run
    env_runner = hydra.utils.instantiate(
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 222, in instantiate
    return instantiate_node(
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 325, in instantiate_node
    _target_ = _resolve_target(node.get(_Keys.TARGET), full_key)
  File "/root/miniforge3/envs/equidiff/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 139, in _resolve_target
    raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error locating target 'equi_diffpo.env_runner.robomimic_image_runner.RobomimicImageRunner', see chained exception above.
full_key: task.env_runner

Thank you for your help!

@pointW
Copy link
Owner

pointW commented Feb 6, 2025

It looks like you had ‘PYOPENGL_PLATTFORM=osmesa’, there is an extra T

@jxxtin
Copy link
Author

jxxtin commented Feb 7, 2025

Thank you so much. The issue has been resolved! Since I copied the command from the README, I think updating its content should be enough.

@pointW
Copy link
Owner

pointW commented Feb 7, 2025

Ah I see, this is a typo in the readme, I just fixed it. Sry about that

@jxxtin jxxtin closed this as completed Feb 8, 2025
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

2 participants