Closed hbonnavaud closed 2 years ago
I found out that if I comment the loading of the library, it works to render an image. I am really not sure what is wrong with it, maybe someone with more experience can help us here.
#export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
Thank you! In other issues, I wrote the export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
into ~/.bashrc, and then I couldn't get an rgb_array for env.render('rgb_array') directly, I must first env.render(), then get an img from env.render ("rgb_array").
Yes, that is exactly the behaviour I am experiencing. I can render images only with the commented lines but then I cannot render the environment and vice versa. It would be amazing if both worked at the same time without altering the ~/.bashrc
file.
What's very annoying is, different Ubuntu versions also affect the render of mujoco (version 2.0 and below). I list some common permutations here: Conflict between render and image of robosuite
Of course, you may need to Google translate~
There have been multiple issues which relate to the same error (#598, #187, #390) but unfortunately none of them worked for me. What worked was to change this line in <site_packages>/gym/envs/mujoco/mujoco_env.py
to:
self.viewer = mujoco_py.MjRenderContextOffscreen(self.sim, None, -1)
You can find the location of <site_packages>
in your system by using pip show gym
.
Ty @nikhilweee, maybe this correction should be included inside the mujoco.py code, and shouldn't be something the user should change?
@nikhilweee, you just made my life so much easier! Thank you for your answer!
@nikhilweee, are you able to render without starting the terminal or id with the graphics card? For me it throws the error of libGL error: failed to load driver: iris
.
Ty @nikhilweee, maybe this correction should be included inside the mujoco.py code, and shouldn't be something the user should change?
@hbonnavaud It definitely shouldn't be something that the user needs to change, so maybe a PR would help? Another way maybe is to create a wrapper which fixes this?
@nikhilweee, are you able to render without starting the terminal or id with the graphics card? For me it throws the error of libGL error: failed to load driver: iris.
@tudorjnu I usually render offscreen using xvfb-run -a
, but if it's a driver issue that suggests you have a missing file?
There have been multiple issues which relate to the same error (#598, #187, #390) but unfortunately none of them worked for me. What worked was to change this line in
<site_packages>/gym/envs/mujoco/mujoco_env.py
to:self.viewer = mujoco_py.MjRenderContextOffscreen(self.sim, None, -1)
You can find the location of
<site_packages>
in your system by usingpip show gym
.
Thankyou!!! you make my life very easier :) 감사합니다
I use this method, but there are two Creating window glfw in my program, and one is stuck because it doesn't get any output display information. Do you know why? Thank you very much for your answer!!
I use this method, but there are two Creating window glfw in my program, and one is stuck because it doesn't get any output display information. Do you know why? Thank you very much for your answer!!
没太懂你的问题,建议报错贴详细信息,另外可以先参考一下我的这个教程:https://github.com/kaixindelele/Mujoco-Issues#robosuite%E7%9A%84render%E5%92%8Cimage%E5%86%B2%E7%AA%81%E9%97%AE%E9%A2%98
没太懂你的问题,建议报错贴详细信息,另外可以先参考一下我的这个教程:https://github.com/kaixindelele/Mujoco-Issues#robosuite%E7%9A%84render%E5%92%8Cimage%E5%86%B2%E7%AA%81%E9%97%AE%E9%A2%98
我看到了一个同学可以同时拿到渲染场景和图片(https://blog.csdn.net/zhangkefang45/article/details/107313009?spm=1001.2014.3001.5502),所以就想尝试一下,但是我这样做之后画面一闪而过,且提示我Failed to initialize OpenGL,
我尝试按照上述说法更改MjRenderContextOffscreen,得到了下面这样的结果
没太懂你的问题,建议报错贴详细信息,另外可以先参考一下我的这个教程:https://github.com/kaixindelele/Mujoco-Issues#robosuite%E7%9A%84render%E5%92%8Cimage%E5%86%B2%E7%AA%81%E9%97%AE%E9%A2%98
我看到了一个同学可以同时拿到渲染场景和图片(https://blog.csdn.net/zhangkefang45/article/details/107313009?spm=1001.2014.3001.5502),所以就想尝试一下,但是我这样做之后画面一闪而过,且提示我Failed to initialize OpenGL, 我尝试按照上述说法更改MjRenderContextOffscreen,得到了下面这样的结果
你看我的帖子了么?这个很大程度上是因为你的Ubuntu版本是16.04,而你参考的博客的版本可能是18以上。至于为什么,我还不太清楚。如果说错了,可以先贴出来看看~
没太懂你的问题,建议报错贴详细信息,另外可以先参考一下我的这个教程:https://github.com/kaixindelele/Mujoco-Issues#robosuite%E7%9A%84render%E5%92%8Cimage%E5%86%B2%E7%AA%81%E9%97%AE%E9%A2%98
我看到了一个同学可以同时拿到渲染场景和图片(https://blog.csdn.net/zhangkefang45/article/details/107313009?spm=1001.2014.3001.5502),所以就想尝试一下,但是我这样做之后画面一闪而过,且提示我Failed to initialize OpenGL, 我尝试按照上述说法更改MjRenderContextOffscreen,得到了下面这样的结果
你看我的帖子了么?这个很大程度上是因为你的Ubuntu版本是16.04,而你参考的博客的版本可能是18以上。至于为什么,我还不太清楚。如果说错了,可以先贴出来看看~
我的ubuntu系统是20.04的,我也没搞清楚为什么在会出现两个viewer,我并没有更改过底层的rende函数,现在采取的方案就是不使用gym,只在mujoco中渲染得到我自己设定的camera的rgb和depth。
没太懂你的问题,建议报错贴详细信息,另外可以先参考一下我的这个教程:https://github.com/kaixindelele/Mujoco-Issues#robosuite%E7%9A%84render%E5%92%8Cimage%E5%86%B2%E7%AA%81%E9%97%AE%E9%A2%98
I saw a classmate who could get both the rendered scene and the image (https://blog.csdn.net/zhangkefang45/article/details/107313009?spm=1001.2014.3001.5502), so I wanted to try it, but when I did so, the screen flashed and I was prompted to Failed To initialize OpenGL, I tried changing the MjRenderContextOffscreen as described above and got something like this
你看我的帖子了么?这个很大程度上是因为你的Ubuntu版本是16.04,而你参考的博客的版本可能是18以上。至于为什么,我还不太清楚。如果说错了,可以先贴出来看看~
我的ubuntu系统是20.04的,我也没搞清楚为什么在会出现两个viewer,我并没有更改过底层的rende函数,现在采取的方案就是不使用gym,只在mujoco中渲染得到我自己设定的camera的rgb和depth。
i am also getting the mujoco_py viewer but i dont required it did you solve this problem ??
If you are running rendering and an RGB display for training simultaneously, it is normal for two windows to open, and seeing a black screen is typical.
If you have attempted training, it should be working properly even if the screen is black. To check if the values are being outputted correctly, you can use matplotlib to visualize them.
One tip would be not to render twice; instead, concatenate the RGB vectors and create a program that automatically saves the video, which is much more efficient.
Have a nice day :)
If you are running rendering and an RGB display for training simultaneously, it is normal for two windows to open, and seeing a black screen is typical.
If you have attempted training, it should be working properly even if the screen is black. To check if the values are being outputted correctly, you can use matplotlib to visualize them.
One tip would be not to render twice; instead, concatenate the RGB vectors and create a program that automatically saves the video, which is much more efficient.
Have a nice day :)
thank you got it
Describe the bug Unable to generage rgb array of environment state / image using environment.render (mode="rgb_array").
To Reproduce Run the following code:
Expected behavior An image is returned and stored inside
image
variable, as a numpy.ndarray of pixels values.Error Messages
Desktop (please complete the following information):
Environment
output of:
echo $LD_LIBRARY_PATH
-> /home/disc/h.bonnavaud/.mujoco/mujoco210/bin:/usr/lib/nvidiaoutput of:
echo $HOME
-> /home/disc/h.bonnavaudoutput of:
echo $USER
-> h.bonnavaudoutput of:
echo $LD_PRELOAD
-> /usr/lib/x86_64-linux-gnu/libGLEW.sooutput of:
glxinfo | grep "OpenGL version"
-> OpenGL version string: 4.6 (Compatibility Profile) Mesa 21.0.3Additional context I found many hints about this problem but nothing about an error like "Found 0 GPUs for rendering. Using device 0.". Reading this line, the problem looks obvious since indice 0 of an empty list is out of range, but I have no idea how to solve it. Do not hesitate to redirect me if I'm at the wrong place, or if you know any helpful other issues reports. Thanks a lot.