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

GLFW Issue on Ubuntu 24.04 #2393

Open
2 tasks done
david-dorf opened this issue Jan 28, 2025 · 3 comments
Open
2 tasks done

GLFW Issue on Ubuntu 24.04 #2393

david-dorf opened this issue Jan 28, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@david-dorf
Copy link

Intro

Hi!

I am a robotics engineer at Triton Systems and I use MuJoCo for simulation.

My setup

MuJoCo 3.2.7 on PyPi (Python), AMD64, Ubuntu 24.04

What's happening? What did you expect?

Running within a Bazel module:

INFO: Running command line: bazel-bin/mujoco_py
/home/david/.cache/bazel/_bazel_david/f695e6f26414630bc7daef67dcbe0426/execroot/_main/bazel-out/k8-fastbuild/bin/mujoco_py.runfiles/.mujoco_py.venv/lib/python3.12/site-packages/glfw/init.py:917: GLFWError: (65548) b'Wayland: The platform does not provide the window position'
warnings.warn(message, GLFWError)

Attempts to import GLFW directly haven't worked to eliminate this from popping up every time the viewer is opened.

Steps for reproduction

  1. Run the code below.
  2. Get the warning message.

Minimal model for reproduction

Shouldn't need this if you import the robot_descriptions package as follows

Code required for reproduction

import time
import mujoco
import mujoco.viewer
from robot_descriptions.loaders.mujoco import load_robot_description


model = load_robot_description("panda_mj_description")
data = mujoco.MjData(model)

with mujoco.viewer.launch_passive(model, data) as viewer:
    try:
        while viewer.is_running():
            step_start = time.time()
            mujoco.mj_step(model, data)
            with viewer.lock():
                viewer.opt.flags[mujoco.mjtVisFlag.mjVIS_CONTACTPOINT] = int(data.time % 2)
            viewer.sync()
            time_until_next_step = model.opt.timestep - (time.time() - step_start)
            if time_until_next_step > 0:
                time.sleep(time_until_next_step)
    except KeyboardInterrupt:
        pass

Confirmations

@david-dorf david-dorf added the bug Something isn't working label Jan 28, 2025
@wpumacay
Copy link
Contributor

wpumacay commented Feb 2, 2025

Hi @david-dorf . I think I ran into a similar issue the other day when using wayland. Could you check which version of glfw are you using?

pip freeze | grep glfw

If you're using version 1.12.0 then you'll just have to update to the latest version (current is 2.8.0). I get the same warning, but the visualizer opens normally. I got this issue bc it seems that the package from dm_control uses an old version of glfw in their requirements.txt file.

Hope this solves your issue.

@david-dorf
Copy link
Author

It's version 2.8.0, but it's just that the warning is a little annoying - not really a major issue stopping me from doing anything. If this is already expected then I can close this issue.

@LaVieEstDure
Copy link

I have glfw version 2.7.0 and I get a GLFWError: (65544) b'Wayland: Window position retrieval not supported' warnings.warn(message, GLFWError) and it actually makes it so that none of the buttons on the MJ visualiser work.

Adding an environment variable to force GLFW to use x11 instead works in fixing both the warning and the issues with the buttons: export PYGLFW_LIBRARY_VARIANT=x11. If it's just an annoying warning and you have XWayland, maybe just use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants