off-policy-continuous-control icon indicating copy to clipboard operation
off-policy-continuous-control copied to clipboard

"pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to 'None'" about the water-maze environment

Open HzfFrank opened this issue 10 months ago • 0 comments

Thank you for your awesome work!

I also want to test the environment you provided in the repo, I wrote a "test environment" file similar with your test_env.py

But when I test the water-maze environment in vscode terminal, it shows that

envs/make_pomdp_env.py:247: in _make_pomdp_env
    result_dict['train_env'] = gym.wrappers.RescaleAction(gym.make(env_name), -1, 1)
../../.conda/envs/py38/lib/python3.8/site-packages/gym/envs/registration.py:235: in make
    return registry.make(id, **kwargs)
../../.conda/envs/py38/lib/python3.8/site-packages/gym/envs/registration.py:129: in make
    env = spec.make(**kwargs)
../../.conda/envs/py38/lib/python3.8/site-packages/gym/envs/registration.py:89: in make
    cls = load(self.entry_point)
../../.conda/envs/py38/lib/python3.8/site-packages/gym/envs/registration.py:27: in load
    mod = importlib.import_module(mod_name)
../../.conda/envs/py38/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
envs/yang_domains/water_maze.py:8: in <module>
    from gym.envs.classic_control import rendering as visualize
../../.conda/envs/py38/lib/python3.8/site-packages/gym/envs/classic_control/rendering.py:27: in <module>
    from pyglet.gl import *
../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/gl/__init__.py:191: in <module>
    import pyglet.window
../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/window/__init__.py:1930: in <module>
    gl._create_shadow_window()
../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/gl/__init__.py:165: in _create_shadow_window
    _shadow_window = ShadowWindow()
../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/gl/__init__.py:159: in __init__
    super().__init__(width=1, height=1, visible=False)
../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/window/xlib/__init__.py:138: in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/window/__init__.py:514: in __init__
    display = pyglet.canvas.get_display()
../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/canvas/__init__.py:59: in get_display
    return Display()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pyglet.canvas.xlib.XlibDisplay object at 0x7fe6d6cc7820>, name = None, x_screen = 0

    def __init__(self, name=None, x_screen=None):
        if x_screen is None:
            x_screen = 0
    
        if isinstance(name, str):
            name = c_char_p(name.encode('ascii'))
    
        self._display = xlib.XOpenDisplay(name)
        if not self._display:
>           raise NoSuchDisplayException(f'Cannot connect to "{name}"')
E           pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

../../.conda/envs/py38/lib/python3.8/site-packages/pyglet/canvas/xlib.py:88: NoSuchDisplayException
======================================================================================== short test summary info ========================================================================================
FAILED test/test_pomdp_env.py::test_make_on_policy_domain_env - pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

It seems that the water-maze environment does need some screen to show, however, I just want to test it.

Other tasks like ur5 didn't show such wrong message.

I would like to query that how did you test the water-maze task and what's the result.

HzfFrank avatar Apr 16 '24 09:04 HzfFrank