opendilab / LightZero

[NeurIPS 2023 Spotlight] LightZero: A Unified Benchmark for Monte Carlo Tree Search in General Sequential Decision Scenarios (awesome MCTS)
https://huggingface.co/spaces/OpenDILabCommunity/ZeroPal
Apache License 2.0
1.07k stars 110 forks source link

problem in atari_eval.py #114

Closed spring520 closed 11 months ago

spring520 commented 11 months ago

I want to rendering the agent using Atari_eval.py. but I got a problem looks like this

[10-19 11:34:38] WARNING  If you want to use numba to speed up segment tree, please install numba first                                                                      default_helper.py:441
A.L.E: Arcade Learning Environment (version 0.7.5+db37282)
[Powered by Stella]
Traceback (most recent call last):
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/ding/envs/env_manager/base_env_manager.py", line 111, in __init__
    self._observation_space = self._env_ref.observation_space
  File "/remote-home/zzq/13-MCTS-learn/LightZero/zoo/atari/envs/atari_lightzero_env.py", line 154, in observation_space
    return self._observation_space
AttributeError: 'AtariLightZeroEnv' object has no attribute '_observation_space'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/remote-home/zzq/13-MCTS-learn/LightZero/zoo/atari/entry/atari_eval.py", line 31, in <module>
    returns_mean, returns = eval_muzero(
  File "/remote-home/zzq/13-MCTS-learn/LightZero/lzero/entry/eval_muzero.py", line 52, in eval_muzero
    evaluator_env = create_env_manager(cfg.env.manager, [partial(env_fn, cfg=c) for c in evaluator_env_cfg])
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/ding/envs/env_manager/base_env_manager.py", line 528, in create_env_manager
    return ENV_MANAGER_REGISTRY.build(manager_type, env_fn=env_fn, cfg=manager_cfg)
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/ding/utils/registry.py", line 96, in build
    raise e
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/ding/utils/registry.py", line 82, in build
    return build_fn(*obj_args, **obj_kwargs)
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/ding/envs/env_manager/base_env_manager.py", line 120, in __init__
    self._env_ref.reset()
  File "/remote-home/zzq/13-MCTS-learn/LightZero/zoo/atari/envs/atari_lightzero_env.py", line 59, in reset
    self._env = self._make_env()
  File "/remote-home/zzq/13-MCTS-learn/LightZero/zoo/atari/envs/atari_lightzero_env.py", line 55, in _make_env
    return wrap_lightzero(self.cfg, episode_life=self.cfg.episode_life, clip_rewards=self.cfg.clip_rewards)
  File "/remote-home/zzq/13-MCTS-learn/LightZero/zoo/atari/envs/atari_wrappers.py", line 90, in wrap_lightzero
    env = gym.make(config.env_name, render_mode='human')
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/gym/envs/registration.py", line 662, in make
    env = env_creator(**_kwargs)
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/gym/envs/atari/environment.py", line 136, in __init__
    self.seed()
  File "/remote-home/zzq/anaconda3/envs/MCTS/lib/python3.9/site-packages/gym/envs/atari/environment.py", line 196, in seed
    self.ale.loadROM(getattr(roms, self._game))
RuntimeError: Failed to initialize SDL

need help here

puyuan1996 commented 11 months ago

Hello, the RuntimeError: Failed to initialize SDL you've encountered is likely due to running code that involves graphical rendering on a server without a Graphical User Interface (GUI). We propose two solutions:

Please choose the solution that best fits your situation and needs.

Rohxn16 commented 11 months ago

i would like to work on this issue