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

Fix for 'GLEW initalization error' #145

Closed
wants to merge 18 commits into from

Conversation

ethanabrooks
Copy link
Contributor

This fixes this issue: #44 (comment). However, I'm not sure what the impacts of taking out glewegl are, or if this will cause issues on other systems. Let me know if there are some checks that I should add to determine whether to use glew or glewegl.

@foolyc
Copy link

foolyc commented Oct 26, 2017

Hi, @lobachevzky
I tried your solution, but when i use sim.render(201, 205, camera_name="topcam"), it fails with following error
Found 1 GPUs for rendering. Using device 0. Could not make EGL context current
I wonder if you have this problem. Thanks.

@agakshat
Copy link

I'm facing the GLEW initialization error too. Can someone merge this into the main repo?

@machinaut
Copy link
Contributor

@agakshat @foolyc does checking out this branch solve the issues for you?

@agakshat
Copy link

Actually, no. It creates some other error: doing import mujoco_py now gives error ImportError: cannot import name build_callback_fn. Can't actually get around to checking if the GLEW initialization error has been rectified or not.

@machinaut
Copy link
Contributor

@agakshat that seems like a different (and new?) error, and might be worth filing a separate issue on

@agakshat
Copy link

agakshat commented Oct 30, 2017 via email

@ethanabrooks
Copy link
Contributor Author

@foolyc I get the same problem. Here are the errors I get:

MjViewer.render() MjSim.render(width, height, camera_name) program uses both
MUJOCO_PY_FORCE_CPU undefined works RuntimeError: Failed to initialize OpenGL RuntimeError: Failed to initialize OpenGL
MUJOCO_PY_FORCE_CPU=1 works No error, but creates empty glfw window No error but creates distorted image

Here's a picture of the distorted image:
distorted

I posted about this issue previously: #133 (comment)

What I figured out is that rendering onscreen and offscreen works if they both use glfw. I implemented a somewhat hacky fix in this fork. The way I read arrays using this code is

viewer.render(dimensions, camera_id, offscreen=True)
array = viewer.read_pixels(*dimensions, depth=False)

But this is not great because:

  1. offscreen becomes a parameter to the viewer, which is clunky.
  2. because both onscreen and offscreen rendering use glfw instead of egl, I'm not sure if these processes are benefiting from the GPU, although they do seem to show up as processes under nvidia-smi .

This is a problem I am continuing to investigate. It might be illuminating to look at my conversation with Emo about this on the mujoco forum:
http://www.mujoco.org/forum/index.php?threads/glew-initalization-error-missing-gl-version.3508/
http://www.mujoco.org/forum/index.php?threads/how-to-simultaneously-visualize-and-render-offscreen.3517/#post-4228

@ethanabrooks
Copy link
Contributor Author

ethanabrooks commented Nov 1, 2017

This fixes the distorted image problem, so everything should work with MUJOCO_PY_FORCE_CPU=1 but getting things to work with EGL and the GPU is still a problem. The error that @foolyc and I are experiencing occurs at initOpenGL. I don't understand EGL well enough to understand why this is.

@ethanabrooks
Copy link
Contributor Author

@agakshat, that function is defined in mujoco_py/builder.py. My guess is that it is a result of an earlier exception being thrown. Can you post the full traceback?

@agakshat
Copy link

agakshat commented Nov 1, 2017

So the full traceback is as follows:

Traceback (most recent call last):
File "", line 1, in
File "/home/foo/Downloads/mujoco-py/mujoco_py/init.py", line 1, in
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "/home/foo/Downloads/mujoco-py/mujoco_py/builder.py", line 315, in
cymj = load_cython_ext(mjpro_path)
File "/home/foo/Downloads/mujoco-py/mujoco_py/builder.py", line 77, in load_cython_ext
mod = imp.load_dynamic("cymj", cext_so_path)
File "/home/foo/tensorflow/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
File "mujoco_py/mjsim.pyx", line 3, in init mujoco_py.cymj
from threading import Lock
ImportError: cannot import name build_callback_fn

Note: from threading import Lock does work independently. Also, I am working in a python virtualenv, with Python 3.5.2, if that makes any difference

@ethanabrooks
Copy link
Contributor Author

@agakshat judging from the traceback, it looks like you are using a different version of the code than I am. For example, I execute cymj = load_cython_ext(mjpro_path) at line 439 in my code and I don't execute mod = imp.load_dynamic("cymj", cext_so_path) anywhere at all. I did recently pull the latest version of this repository from master. Maybe that accounts for the difference.

@ethanabrooks
Copy link
Contributor Author

One thing that would help me debug the issues with EGL is if I had a working makefile for eglshim.c. I tried coming up with the build command for that file, but no matter how many libraries I try to link into the build, I still get undefined reference errors.

@machinaut
Copy link
Contributor

@lobachevzky are you able to build the eglshim in a docker container? I think the dockerfile has all of the pre-requisites, including a cpu-only GL library implementation.

@ethanabrooks
Copy link
Contributor Author

@machinaut, I'm not sure how I could use docker to get the correct build command. To clarify what I am after, I have a small working example using raw mujoco code and glfw. I would like that code to call the function initOpenGL in the file eglshim.c so that I could play around with it and figure out what causes the error. I have tried a lot of different build commands, most variations on gcc -I/home/ethanbro/.mujoco/mjpro150/include/ -I/home/ethanbro/mujoco-py/mujoco_py/gl/ -L/home/ethanbro/.mujoco/mjpro150/bin/ -lEGL -lglewegl -lOpenGL src/eglshim.c but I always get:

src/eglshim.c: In function ‘initOpenGL’:
src/eglshim.c:122:17: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
         fprintf("glewInit error: %s\n", glewGetErrorString(err));
                 ^
In file included from src/eglshim.c:14:0:
/usr/include/stdio.h:356:12: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 extern int fprintf (FILE *__restrict __stream,
            ^
src/eglshim.c:122:9: warning: format not a string literal and no format arguments [-Wformat-security]
         fprintf("glewInit error: %s\n", glewGetErrorString(err));
         ^
src/eglshim.c: In function ‘copyFBOToPBO’:
src/eglshim.c:277:22: warning: passing argument 7 of ‘glReadPixels’ makes pointer from integer without a cast [-Wint-conversion]
                      bufferOffset * viewport.width * viewport.height * 3);
                      ^
In file included from src/eglshim.c:4:0:
/usr/include/GL/glew.h:1082:23: note: expected ‘void *’ but argument is of type ‘int’
 GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
                       ^
src/eglshim.c:284:22: warning: passing argument 7 of ‘glReadPixels’ makes pointer from integer without a cast [-Wint-conversion]
                      bufferOffset * viewport.width * viewport.height * sizeof(short));
                      ^
In file included from src/eglshim.c:4:0:
/usr/include/GL/glew.h:1082:23: note: expected ‘void *’ but argument is of type ‘long unsigned int’
 GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
                       ^
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccX29xNc.o: In function `initOpenGL':
eglshim.c:(.text+0x104): undefined reference to `eglGetProcAddress'
eglshim.c:(.text+0x173): undefined reference to `eglGetProcAddress'
eglshim.c:(.text+0x203): undefined reference to `eglInitialize'
eglshim.c:(.text+0x245): undefined reference to `eglChooseConfig'
eglshim.c:(.text+0x268): undefined reference to `eglBindAPI'
eglshim.c:(.text+0x2a1): undefined reference to `eglCreateContext'
eglshim.c:(.text+0x2e9): undefined reference to `eglMakeCurrent'
eglshim.c:(.text+0x307): undefined reference to `eglDestroyContext'
eglshim.c:(.text+0x320): undefined reference to `glewInit'
eglshim.c:(.text+0x33c): undefined reference to `glewGetErrorString'
/tmp/ccX29xNc.o: In function `makeOpenGLContextCurrent':
eglshim.c:(.text+0x422): undefined reference to `eglMakeCurrent'
eglshim.c:(.text+0x44c): undefined reference to `eglDestroyContext'
/tmp/ccX29xNc.o: In function `closeOpenGL':
eglshim.c:(.text+0x4e0): undefined reference to `eglMakeCurrent'
eglshim.c:(.text+0x4fa): undefined reference to `eglDestroyContext'
eglshim.c:(.text+0x506): undefined reference to `eglTerminate'
/tmp/ccX29xNc.o: In function `createPBO':
eglshim.c:(.text+0x54e): undefined reference to `__glewGenBuffers'
eglshim.c:(.text+0x563): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x5ab): undefined reference to `__glewBufferData'
eglshim.c:(.text+0x5c7): undefined reference to `__glewBindBuffer'
/tmp/ccX29xNc.o: In function `freePBO':
eglshim.c:(.text+0x5fe): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x611): undefined reference to `__glewDeleteBuffers'
/tmp/ccX29xNc.o: In function `readPBO':
eglshim.c:(.text+0x64d): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x660): undefined reference to `__glewMapBufferARB'
eglshim.c:(.text+0x6a0): undefined reference to `__glewUnmapBuffer'
eglshim.c:(.text+0x6b4): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x6c7): undefined reference to `__glewMapBufferARB'
eglshim.c:(.text+0x702): undefined reference to `__glewUnmapBuffer'
eglshim.c:(.text+0x710): undefined reference to `__glewBindBuffer'
/tmp/ccX29xNc.o: In function `copyFBOToPBO':
eglshim.c:(.text+0x790): undefined reference to `__glewBlitFramebuffer'
eglshim.c:(.text+0x7a0): undefined reference to `__glewBindFramebuffer'
eglshim.c:(.text+0x7ba): undefined reference to `glReadBuffer'
eglshim.c:(.text+0x7c1): undefined reference to `__glewBindFramebuffer'
eglshim.c:(.text+0x7db): undefined reference to `glDrawBuffer'
eglshim.c:(.text+0x7e2): undefined reference to `__glewBlitFramebuffer'
eglshim.c:(.text+0x831): undefined reference to `__glewBindFramebuffer'
eglshim.c:(.text+0x84a): undefined reference to `__glewBindFramebuffer'
eglshim.c:(.text+0x864): undefined reference to `glReadBuffer'
eglshim.c:(.text+0x871): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x8bb): undefined reference to `glReadPixels'
eglshim.c:(.text+0x8c6): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x8df): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x926): undefined reference to `glReadPixels'
eglshim.c:(.text+0x931): undefined reference to `__glewBindBuffer'
eglshim.c:(.text+0x944): undefined reference to `__glewBindFramebuffer'
eglshim.c:(.text+0x95e): undefined reference to `glReadBuffer'
eglshim.c:(.text+0x968): undefined reference to `glDrawBuffer'
collect2: error: ld returned 1 exit status

This confuses me because according to nm -D path/to/lib many of these functions are included in the libraries that I am linking. I think I am making some simple mistake in the order of arguments or something, but I am not a very experienced C programmer.

As for Docker, I cannot get it to work with my mjkey.txt, which seems to be a known issue with mujoco.

Any tips on the build command or on getting docker to work with mujoco are welcome.

@ethanabrooks
Copy link
Contributor Author

I've been trying to adapt the make egl command from the mujoco makefile to compile eglshim.c and I'm getting what appear to be legitimate errors:

❯ g++ -O2 -I$HOME/mujoco-py/mujoco_py/gl/ -I$HOME/.mujoco/mjpro150/include -L$HOME/.mujoco/mjpro150/bin -std=c++11 -mavx -DMJ_EGL src/eglshim.c -lmujoco150 -lOpenGL -lEGL -lglewegl
src/eglshim.c: In function ‘int initOpenGL(int)’:
src/eglshim.c:122:64: error: cannot convert ‘const char*’ to ‘FILE* {aka _IO_FILE*}’ for argument ‘1’ to ‘int fprintf(FILE*, const char*, ...)’
         fprintf("glewInit error: %s\n", glewGetErrorString(err));
                                                                ^
src/eglshim.c: In function ‘void copyFBOToPBO(mjrContext*, unsigned int, unsigned int, mjrRect, int)’:
src/eglshim.c:277:70: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]
                      bufferOffset * viewport.width * viewport.height * 3);
                                                                      ^
In file included from src/eglshim.c:4:0:
/usr/include/GL/glew.h:1082:23: note:   initializing argument 7 of ‘void glReadPixels(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*)’
 GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
                       ^
src/eglshim.c:284:70: error: invalid conversion from ‘long unsigned int’ to ‘void*’ [-fpermissive]
                      bufferOffset * viewport.width * viewport.height * sizeof(short));
                                                                      ^
In file included from src/eglshim.c:4:0:
/usr/include/GL/glew.h:1082:23: note:   initializing argument 7 of ‘void glReadPixels(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*)’
 GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);

So, for the first, fprintf does in fact take a file pointer, not a string for its first argument.
For the remainder, glReadPixels takes a void* for its last argument (this is where the pixels get read to). Instead, eglshim.c seems to provide the size of the data to be read (an int).

So are these actually errors in eglshim.c or am I just including the wrong headers?

@lutein
Copy link

lutein commented Mar 1, 2018

@Kukanani Thanks a lot! Works for me on Ubuntu 16.04, Python 3.5.2, cuda 9.1

@emigmo
Copy link

emigmo commented Mar 6, 2018

@Kukanani Thanks a lot.
For me.
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
NOT LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/nvidia-384/libGL.so

@kirk86
Copy link

kirk86 commented Mar 15, 2018

all these efforts and wealth of information should be reflected into some docs or manual regarding particular errors. BTW I'm still having issues:

GLFW error (code %d): %s 65544 b'X11: RandR gamma ramp support seems broken'
GLFW error (code %d): %s 65542 b'EGL: Failed to get EGL display: Success'
Creating window glfw
ERROR: GLEW initalization error: Missing GL version

@huiwenzhang
Copy link

huiwenzhang commented Mar 15, 2018

@Kukanani Hi, thank you for your answer. It works for me. I want to know is there any other way to solve this more elegant? By the way, if I want to use this command and debug code in PyCharm, how should I setting this in config/run configurations page given that "LD_PRELOAD....." is a prefix command? I set this in .bashrc, but it seems that PyCharm can't recognize this. so I have to use this command explicitly.

@Kukanani
Copy link

I'm glad it's working for some folks. Happy to help.
@huiwenzhang I have not found a more elegant way, although I did set it up as a bash alias, so I just run mjpython instead of python and it works seamlessly.

I also use command line, not PyCharm, so I'm not sure how you would set that up. I guess one easy way is to just always run from the built in PyCharm console :)

@adamzhang129
Copy link

@Kukanani
Thank you very much, this works for me:
pip install --no-cache-dir -e .
to install the package.
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
now I can run FetchSlide render from openAI.

@Taylor-Liu
Copy link

Taylor-Liu commented Apr 18, 2018

@mjlbach Thankyou for your solution. For env.render() to work normally when using mujoco_py in gym, try these steps:

  1. sudo apt-get install libglew-dev libglfw3-dev
  2. git clone https://github.com/openai/mujoco-py.git
  3. cd mujoco-py
  4. pip install --no-cache-dir -e .
  5. export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
  6. python /path/to/example

Then the following code example could work:

import gym
env = gym.make('Ant-v2')
env.render()

@zxgineng
Copy link

@GrazyThinking This works for me. Thanks!

@inspirepassion
Copy link

inspirepassion commented Sep 6, 2018

To update what's happening to my case for
@jeremyf21 's reply #75 (comment)
1 I don't have libGLEW.so under /usr/lib/x86_64-linux-gnu/ in my file system (Ubuntu 18.04)
Solution: sudo apt-get install libglew-dev, I read it from this issue report: raulmur/ORB_SLAM2#210

2 I don't have libGL.so under /usr/lib/nvidia-39*/ (I don't even have this folder), but when I searched the whole file system, libGL.so is actually located in /usr/lib/x86_64-linux-gnu
Solution:

open .bashrc sudo gedit ~/.bashrc
add this line at the end export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/x86_64-linux-gnu/libGL.so (this is just a modification to people's previous reply, and I think some people might encounter similar situation)
save it, and restart the terminal, and WOLA~

@MrDadaGuy
Copy link

I have done all of the suggestions on this page and still get the GLEW initialization error message. Any other ideas?
I have ubuntu 18.04 & mjpro150

@MrDadaGuy
Copy link

Answering my own question here -- my issue was that I was using NVidia binary drivers (download from their web site). once I switched to ubuntu repository version of nvidia drivers, everything works fine with the suggestions above.

@yosider
Copy link

yosider commented Jun 1, 2019

If you don't have /usr/lib/x86_64-linux-gnu/libGLEW.so, you need
$ sudo apt install libglew-dev
before export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so

@anish-pratheepkumar
Copy link

To update what's happening to my case for
@jeremyf21 's reply #75 (comment)
1 I don't have libGLEW.so under /usr/lib/x86_64-linux-gnu/ in my file system (Ubuntu 18.04)
Solution: sudo apt-get install libglew-dev, I read it from this issue report: raulmur/ORB_SLAM2#210

2 I don't have libGL.so under /usr/lib/nvidia-39*/ (I don't even have this folder), but when I searched the whole file system, libGL.so is actually located in /usr/lib/x86_64-linux-gnu
Solution:

open .bashrc sudo gedit ~/.bashrc
add this line at the end export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/x86_64-linux-gnu/libGL.so (this is just a modification to people's previous reply, and I think some people might encounter similar situation)
save it, and restart the terminal, and WOLA~

Whoa! Man, that sure did work for me! thank you @inspirepassion

For those who might encounter this in the future I will summarise what I understood :

In the end, after getting the result, when you think about it it's all in the error report itself

Creating window glfw

ERROR: GLEW initialization error: Missing GL version

Press Enter to exit ...

GLEW initialization error -> solved by : /home/[username]/[path_to_libGLEW]/libGLEW.so
Missing GL version -> solved by: /home/[username]/[path_to_libEGL.so]/libEGL.so.1

Make sure the path_to_libGLEW or libEGL is not just anywhere in the system it should be inside the working environment lib folder if you are using conda or if you are using just using system python it should be located in the system python lib folder. If its not there just google how to install it.

While installing use 'apt' or 'apt-get' if you are using system python. Exammple: sudo apt-get install -y libegl-mesa0 But don't use this installation for conda environment, use conda specific installations like conda install -c anaconda mesa-libegl-cos6-x86_64

refer this link to mujoco_py - builder.py to check for other dependencies

finally to add in .bashrc
export LD_PRELOAD=/home/[username]/[path_to_libGLEW]/libGLEW.so:/home/[username]/[path_to_libEGL.so]/libEGL.so.1

@lknownothing
Copy link

I have done all of the suggestions on this page and still get the GLEW initialization error message. Any other ideas?
I have ubuntu 18.04 & mjpro150

My problem is same as yours, Have you resolve the problem of GLEW initalization error: Missing GL version.

@codenie
Copy link

codenie commented Feb 24, 2021

I have done all of the suggestions on this page and still get the GLEW initialization error message. Any other ideas?
I have ubuntu 18.04 & mjpro150

My problem is same as yours, Have you resolve the problem of GLEW initalization error: Missing GL version.

I meet the same problem. The path of libGLEW.so and libEGL.so. are added to the LD_PRELOAD in the .bashrc.
Have you solved this problem?

@anish-pratheepkumar
Copy link

are you working in local python environment or anaconda environment ? When you add the path please make sure that it is from the respective environment location. There might be more than one libGLEW.so and libEGL.so in your system

@rojas70
Copy link

rojas70 commented Mar 24, 2021

are you working in local python environment or anaconda environment ? When you add the path please make sure that it is from the respective environment location. There might be more than one libGLEW.so and libEGL.so in your system

@anish-pratheepkumar

  1. When I try to create a simple script to test render like that found in [https://github.com/openai/mujoco-py#install-and-use-mujoco-py] I am not in either conda/virtual env.

  2. I am also trying to render when running some drl benchmarks. I created that environment with conda.

I tried to check if libGLEW or libGL where listed in any of my anaconda environments: anaconda_home/envs/env_name/lib but there was no such listing there.

I tried to copy them from system paths to anaconda paths as shown below but got the same result...

cp /usr/lib/x86_64-linux-gnu/libGL.so  ~/python/anaconda3/envs/env_name/lib
cp /usr/lib/x86_64-linux-gnu/libGLEW.so ~/python/anaconda3/envs/env_name/lib

@anish-pratheepkumar
Copy link

Hi @rojas70 ,

  • For your first case, I believe then you are using the system packages, in that case you can add path to the system libGL and libGLEW to the .bashrc file
  • For the second case you have anaconda environment and seems like you need to install the dependent libraries in that particular environment. Try

conda install -c conda-forge glew
conda install -c anaconda mesa-libegl-cos6-x86_64
conda install -c anaconda cmake
conda install -c anaconda libx11-devel-cos6-x86_64
conda install -c conda-forge xorg-libx11
conda install -c anaconda libglu
conda install -c anaconda freeglut
conda install -c conda-forge glfw

I do not remember the exact dependencies but you can try installing these in your anaconda virtual environment. This should install libGL and libGLEW in your anaconda environment. Then add path to these in your .bashrc.

@rojas70
Copy link

rojas70 commented Apr 21, 2021

@anish-pratheepkumar

*Found a fix. First will list how I had failed and at the end, what helped me solve this.

After finishing the install, I notice that on the conda side, I have the follow

/home/juan/python/anaconda3/envs/rb_bench/lib/libGLU.so
home/juan/python/anaconda3/envs/rb_bench/lib/libGLEW.so
/home/juan/python/anaconda3/envs/rb_bench/lib/libglut.so
/home/juan/python/anaconda3/envs/rb_bench/lib/libglfw.so

But not libGL.so.
I tried to search for libgl1-mesa-dev under conda install repo's but could not find 1.

The error persists in both conda and non-conda environments.

The LD_PRELOAD command in my .bashrc is as follows:

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGL.so:/usr/lib/x86_64-linux-gnu/libGLEW.so:/home/juan/python/anaconda3/envs/rb_bench/lib/libGLEW.so

I am sure that the libraries are properly installed in the system.

Running a C executable from the mujoco2 bin folder (with the makefile including an -L tag that includes either the local copy or the /usr/lib/x86_64-linux-gnu path:

./basic ../model/arm26.xml

Yields:

ERROR: GLEW initalization error: Missing GL version
Press Enter to exit ...

A mujoco_py version demo yields a slightly different output:

self.viewer = CustomMjViewer(sim)
File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/mujoco_py/mjviewer.py", line 133, in init
super().init(sim)
File "/home/juan/python/anaconda3/envs/rb_bench/lib/python3.7/site-packages/mujoco_py/mjviewer.py", line 26, in init
super().init(sim)
File "mujoco_py/mjrendercontext.pyx", line 283, in mujoco_py.cymj.MjRenderContextWindow.init
File "mujoco_py/mjrendercontext.pyx", line 45, in mujoco_py.cymj.MjRenderContext.init
File "mujoco_py/mjrendercontext.pyx", line 101, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
File "mujoco_py/opengl_context.pyx", line 48, in mujoco_py.cymj.GlfwContext.init
File "mujoco_py/opengl_context.pyx", line 97, in mujoco_py.cymj.GlfwContext._create_window
mujoco_py.cymj.GlfwError: Failed to create GLFW window

i.e. namely failed to create GLFW window

I can run ldd on the libraries and see they are properly linked...

*Found a fix:

  • Something made me think that perhaps something with nvidia drivers may have changed.
  • I checked my current driver and it was set to 450 proprietary
  • I decided to check the most recent 460 proprietary driver
  • After a rest both C and py versions worked fine.

I wonder if in fact it was the nvidia driver or something also that reset after a reboot?
I have Ubuntu 20.04 for reference.

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

Successfully merging this pull request may close these issues.