Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Nothing shows up when rendering environments? #338

Closed
amirest123 opened this issue Mar 24, 2023 · 4 comments · Fixed by #340
Closed

[Bug Report] Nothing shows up when rendering environments? #338

amirest123 opened this issue Mar 24, 2023 · 4 comments · Fixed by #340

Comments

@amirest123
Copy link

amirest123 commented Mar 24, 2023

Hi everyone, sorry if this has been covered or deemed too basic but I'm really having an issue here.

When I try to render an environment exactly as it's done in the example code here I simply get a blank window. I'm using windows 11 and currently running python 3.10.10 through a VS code jupyter notebook. I have minigrid 2.2.0, gymnasium 0.26.3, and pygame 2.3.0. However I've tried meddling with different versions of all these things and no configuration seems to work for me, even using the older version of minigrid that runs with matplotlib instead of pygame just produces a blank plot. I am able to get the expected window when running manual_control.py but nothing when trying to use minigrid as intended outside of that. I'm also able to render base gym environments with pygame, eg the lunar landing environment. I'd very much appreciate any help anyone could give me, thanks.

@pseudo-rnd-thoughts
Copy link
Member

Thanks for the issue, I will have a look into it

@BolunDai0216
Copy link
Collaborator

Can you try the following code

import gymnasium as gym

env = gym.make("MiniGrid-Empty-5x5-v0", render_mode="human", screen_size=640)
observation, info = env.reset(seed=42)
for _ in range(1000):
    action = env.action_space.sample()  # User-defined policy function
    observation, reward, terminated, truncated, info = env.step(action)

    if terminated or truncated:
        observation, info = env.reset()
env.close()

and see if you see anything?

@amirest123
Copy link
Author

@BolunDai0216 I had been using that exact code but without the screen_size parameter... I guess that makes all the difference because it's working as expected now. Thanks so much!

@BolunDai0216
Copy link
Collaborator

BolunDai0216 commented Mar 25, 2023

The issue is we have set a really small screen_size as default, so it does appear, just not very noticeable.

You can try removing the screen_size parameter, and if you pay attention there should be a really small window somewhere on your screen.

Thanks for pointing this issue out, we'll update the default screen size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants