"Library "GLU" not found" while using openaAI gym

858 views
Skip to first unread message

Amit Jena

unread,
Aug 31, 2021, 7:33:38 PM8/31/21
to pyglet-users
Hello,

I am using Ubuntu 18.04 to evaluate this simple block of code on python.
############################
import gym

env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
env.close()
##############################

I am getting this error 
Traceback (most recent call last):
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/gym/envs/classic_control/rendering.py", line 27, in <module>
    from pyglet.gl import *
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/pyglet/gl/__init__.py", line 95, in <module>
    from pyglet.gl.lib import GLException
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/pyglet/gl/lib.py", line 149, in <module>
    from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/pyglet/gl/lib_glx.py", line 46, in <module>
    glu_lib = pyglet.lib.load_library('GLU')
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/pyglet/lib.py", line 164, in load_library
    raise ImportError('Library "%s" not found.' % names[0])
ImportError: Library "GLU" not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/mujoco_expts/main.py", line 30, in <module>
    env.render()
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/gym/core.py", line 254, in render
    return self.env.render(mode, **kwargs)
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/gym/envs/classic_control/cartpole.py", line 179, in render
    from gym.envs.classic_control import rendering
  File "/home/grads/a/Desktop/python/codes/mujoco_experiments/4mujoco/lib/python3.8/site-packages/gym/envs/classic_control/rendering.py", line 29, in <module>
    raise ImportError(
ImportError: 
    Error occurred while running `from pyglet.gl import *`
    HINT: make sure you have OpenGL installed. On Ubuntu, you can run 'apt-get install python-opengl'.
    If you're running on a server, you may need a virtual frame buffer; something like this should work:
    'xvfb-run -s "-screen 0 1400x900x24" python <your_script.py>'




I tried installing "freeglut3-dev" ( as advised by https://stackoverflow.com/questions/50446867/importerror-library-glu-not-found/52886029) and python-opengl, but the the error still persists. 

Can anybody help me out??




Reply all
Reply to author
Forward
0 new messages