iglu-contest / gridworld

A reinforcement learning environment for the IGLU 2022 at NeurIPS
GNU Affero General Public License v3.0
32 stars 12 forks source link

FileNotFoundError: Could not find module 'EGL' #23

Open korosig opened 2 years ago

korosig commented 2 years ago

I want to testing the IGLU framework, and I got this error. (Windows 10 pro)

import gym
import gridworld
from gridworld.tasks import DUMMY_TASK

# create vector based env. Rendering is enabled by default. 
# To turn it off, use render=False.
env = gym.make('IGLUGridworld-v0')

# It is mandatory to task the environemnt. 
# For dummy looping, you can use a DUMMY_TASK object:
env.set_task(DUMMY_TASK)
done = False
obs = env.reset()
while not done:
  action = env.action_space.sample()
  obs, reward, done, info = env.step(action)

FileNotFoundError Traceback (most recent call last) File ~\anaconda3\envs\iglu_challenge\lib\site-packages\pyglet\lib.py:143, in LibraryLoader.load_library(self, *names, **kwargs) 142 try: --> 143 lib = ctypes.cdll.LoadLibrary(name) 144 if _debug_lib:

File ~\anaconda3\envs\iglu_challenge\lib\ctypes__init__.py:451, in LibraryLoader.LoadLibrary(self, name) 450 def LoadLibrary(self, name): --> 451 return self._dlltype(name)

File ~\anaconda3\envs\iglu_challenge\lib\ctypes__init.py:373, in CDLL.init__(self, name, mode, handle, use_errno, use_last_error, winmode) 372 if handle is None: --> 373 self._handle = _dlopen(self._name, mode) 374 else:

FileNotFoundError: Could not find module 'EGL' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) Cell In [1], line 7 3 from gridworld.tasks import DUMMY_TASK 5 # create vector based env. Rendering is enabled by default. 6 # To turn it off, use render=False. ----> 7 env = gym.make('IGLUGridworld-v0') 9 # It is mandatory to task the environemnt. 10 # For dummy looping, you can use a DUMMY_TASK object: 11 env.set_task(DUMMY_TASK)

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\gym\envs\registration.py:235, in make(id, kwargs) 234 def make(id, kwargs): --> 235 return registry.make(id, **kwargs)

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\gym\envs\registration.py:129, in EnvRegistry.make(self, path, kwargs) 127 logger.info("Making new env: %s", path) 128 spec = self.spec(path) --> 129 env = spec.make(kwargs) 130 return env

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\gym\envs\registration.py:90, in EnvSpec.make(self, kwargs) 88 else: 89 cls = load(self.entry_point) ---> 90 env = cls(_kwargs) 92 # Make the environment aware of which spec it came from. 93 spec = copy.deepcopy(self)

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\gridworld\env.py:301, in create_env(render, discretize, size_reward, select_and_place, right_placement_scale, render_size, target_in_obs, vector_state, max_steps, action_space, wrong_placement_scale, name) 295 def create_env( 296 render=True, discretize=True, size_reward=True, select_and_place=True, 297 right_placement_scale=1, render_size=(64, 64), target_in_obs=False, 298 vector_state=False, max_steps=250, action_space='walking', 299 wrong_placement_scale=0.1, name='' 300 ): --> 301 env = GridWorld( 302 render=render, select_and_place=select_and_place, 303 discretize=discretize, right_placement_scale=right_placement_scale, 304 wrong_placement_scale=wrong_placement_scale, name=name, 305 render_size=render_size, target_in_obs=target_in_obs, 306 vector_state=vector_state, max_steps=max_steps, 307 action_space=action_space 308 ) 309 if size_reward: 310 env = SizeReward(env)

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\gridworld\env.py:102, in GridWorld.init(self, render, max_steps, select_and_place, discretize, right_placement_scale, wrong_placement_scale, render_size, target_in_obs, action_space, vector_state, name) 99 self.do_render = render 101 if render: --> 102 from gridworld.render import Renderer, setup 103 self.renderer = Renderer(self.world, self.agent, 104 width=self.render_size[0], height=self.render_size[1], 105 caption='Pyglet', resizable=False) 106 setup()

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\gridworld\render.py:5 3 import pyglet 4 pyglet.options["headless"] = True ----> 5 from pyglet.window import Window 6 from pyglet.gl import * 7 from pyglet.graphics import Batch, TextureGroup

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\pyglet\window__init__.py:1907 1904 else: 1905 # Try to determine which platform to use. 1906 if pyglet.options['headless']: -> 1907 from pyglet.window.headless import HeadlessWindow as Window 1908 elif pyglet.compat_platform == 'darwin': 1909 from pyglet.window.cocoa import CocoaWindow as Window

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\pyglet\window\headless__init__.py:41 37 from pyglet.window import WindowException, NoSuchDisplayException, MouseCursorException 38 from pyglet.window import MouseCursor, DefaultMouseCursor, ImageMouseCursor ---> 41 from pyglet.libs.egl import egl 44 from pyglet.canvas.headless import HeadlessCanvas 46 # from pyglet.window import key 47 # from pyglet.window import mouse

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\pyglet\libs\egl\egl.py:17 13 from ctypes import * 15 import pyglet.lib ---> 17 _lib = pyglet.lib.load_library('EGL') 19 _int_types = (c_int16, c_int32) 20 if hasattr(ctypes, 'c_int64'): 21 # Some builds of ctypes apparently do not have c_int64 22 # defined; it's a pretty good bet that these builds do not 23 # have 64-bit pointers.

File ~\anaconda3\envs\iglu_challenge\lib\site-packages\pyglet\lib.py:162, in LibraryLoader.load_library(self, *names, **kwargs) 160 pass 161 elif self.platform == "win32" and o.winerror != 126: --> 162 raise ImportError("Unexpected error loading library %s: %s" % (name, str(o))) 164 raise ImportError('Library "%s" not found.' % names[0])

ImportError: Unexpected error loading library EGL: Could not find module 'EGL' (or one of its dependencies). Try using the full path with constructor syntax. ​

artemZholus commented 2 years ago

From the stack trace I see that you are using quite an outdated environment. Please update it to the latest version from the master branch and try again. In case it does not work, try disabling headless rendering (export IGLU_HEADLESS=0 before a script).