#543·Gymnasium

[Bug Report] render window freezes when `render_mode="human"` (LunarLander) (MacOS)

Author: yash-jhaveriCreated Jun 7, 2023Updated Jul 14, 2026
Labelsbug

Describe the bug

After running the example code for gymnasium from https://gymnasium.farama.org/ (displayed below) in a jupyter notebook and the simulation has finished, my cursor turns into a pinwheel when I hover over the pygame window where the render played. The pygame window cannot be closed or minimized. In my Force Quit Applications list (cmd+opt+esc), it shows python (not responding).

This happens with CartPole-v1 and FrozenLake-v1 as well.

Code example

bash
import gymnasium as gym

env = gym.make("LunarLander-v2", render_mode="human")
observation, info = env.reset()

for _ in range(1000):
   action = env.action_space.sample()
   observation, reward, terminated, truncated, info = env.step(action)

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

System info

I installed gymnasium today (minutes before running the code above) with pip install gymnasium. When I first tried to run the code, I received an error asking me to 'pip install gymnasium[box2d]', which I did with pip install 'gymnasium[box2d]'. After this, I was able to run the code successfully.

My gymnasium version is 0.28.1.

My OS is macOS Ventura 13.2.1.

My python version is 3.10.

Additional context

No response

Checklist

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

Source: Farama-Foundation/Gymnasium