OpenGL Error [Python [OpenGL] [OpenAI Gym]

36 Views Asked by At

So after using openais chatgptand dall-e im using gym and theres this error with my code thats the same error that keeps popping out (for reference i havee intel hd 3000 and its saying theres something which is not there in my opengl) so the code and error is this

code (main.py):

import gym
import matplotlib.pyplot as plt 

env = gym.make('MountainCar-v0')

# Observation and action space 
obs_space = env.observation_space
action_space = env.action_space
print("The observation space: {}".format(obs_space))
print("The action space: {}".format(action_space))

# reset the environment and see the initial observation
obs = env.reset()
print("The initial observation is {}".format(obs))

# Sample a random action from the entire action space
random_action = env.action_space.sample()

# # Take the action and get the new observation space
new_obs, reward, done, info = env.step(random_action)
print("The new observation is {}".format(new_obs))

env.render(mode = "human")

error:

Warning: Parameters to load are deprecated.  Call .resolve and .require separately.
  result = entry_point.load(False)
The observation space: Box(2,)
The action space: Discrete(3)
The initial observation is [-0.53907843  0.        ]
The new observation is [-0.53996238 -0.00088394]    
Traceback (most recent call last):
  File "c:\Users\Acer\Desktop\game-bot\main.py", line 23, in <module>
    env.render(mode = "human")
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\core.py", line 174, in render
    return self._render(mode=mode, close=close)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\core.py", line 341, in _render
    return self.env.render(mode, close)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\core.py", line 174, in render
    return self._render(mode=mode, close=close)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\envs\classic_control\mountain_car.py", line 79, in _render
    self.viewer = rendering.Viewer(screen_width, screen_height)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\gym\envs\classic_control\rendering.py", line 51, in __init__
    self.window = pyglet.window.Window(width=width, height=height, display=display)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\window\win32\__init__.py", line 104, 
in __init__
    super(Win32Window, self).__init__(*args, **kwargs)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\window\__init__.py", line 582, in __init__
    self._create_projection()
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\window\__init__.py", line 590, in _create_projection
    shader.Shader(self._default_vertex_source, 'vertex'),
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\graphics\shader.py", line 794, in __init__
    shader_id = glCreateShader(shader_type)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\gl\lib_wgl.py", line 66, in __call__ 
    return self.func(*args, **kwargs)
  File "C:\Users\Acer\AppData\Local\Programs\Python\Python310\lib\site-packages\pyglet\gl\lib.py", line 25, in MissingFunction
    raise MissingFunctionException(name, requires, suggestions)
pyglet.gl.lib.MissingFunctionException: glCreateShader is not exported by the available OpenGL driver.  OpenGL 2.0 is required for this functionality.

I did try to update opengl but still the same error. I checked lierally all the answers but still im got the same error.

0

There are 0 best solutions below