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] Rendering broken in v0.25 #2972

Closed
1 task done
vmoens opened this issue Jul 17, 2022 · 0 comments · Fixed by #2978
Closed
1 task done

[Bug Report] Rendering broken in v0.25 #2972

vmoens opened this issue Jul 17, 2022 · 0 comments · Fixed by #2978

Comments

@vmoens
Copy link
Contributor

vmoens commented Jul 17, 2022

Describe the bug
Rendering is broken for simple envs (e.g. Pendulum-v1)

Code example

import gym
from gym.wrappers.pixel_observation import PixelObservationWrapper
PixelObservationWrapper(gym.make("Pendulum-v1")).reset()

Error stack:

/path/to/venv/python3.8/site-packages/gym/wrappers/pixel_observation.py in __init__(self, env, pixels_only, render_kwargs, pixel_keys)
    131             pixels: np.ndarray = pixels[-1] if isinstance(pixels, List) else pixels
    132 
--> 133             if np.issubdtype(pixels.dtype, np.integer):
    134                 low, high = (0, 255)
    135             elif np.issubdtype(pixels.dtype, np.float):

AttributeError: 'NoneType' object has no attribute 'dtype'

System Info
Describe the characteristic of your environment:

  • Describe how Gym was installed (pip, docker, source, ...)
pip install gym --upgrade
  • What OS/version of Linux you're using. Note that while we will accept PRs to improve Window's support, we do not officially support it.
    OsX (x86) and Unix
  • Python version
    3.7, 3.8, 3.9 and 3.10

Checklist

  • I have checked that there is no similar issue in the repo (required)

EDIT

I guess this is related to this (from the release note)

Render - The render API is changed such that the mode has to be specified during gym.make with the keyword render_mode, after which, the render mode is fixed. For further details see https://younis.dev/blog/2022/render-api/ and #2671. This has the additional changes
with render_mode="human" you don't need to call .render(), rendering will happen automatically on env.step()
with render_mode="rgb_array", .render() pops the list of frames rendered since the last .reset()
with render_mode="single_rgb_array", .render() returns a single frame, like before.

Specifying render_mode="single_rgb_array" solves it, but it is a bc-breaking change. Any chance we can get a default value there?

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