OpenAI Gym render function not displaying anything on WSL Ubuntu

I’m working with OpenAI Gym on Ubuntu through Windows Subsystem for Linux and having trouble getting the render function to show any visual output. Here’s my simple test code:

import gym

game_env = gym.make('Breakout-v0')
game_env.reset()

for i in range(15):
    game_env.render()
    # Also attempted game_env.render(mode='human')
    game_env.step(game_env.action_space.sample())
    
game_env.close()

When I execute this script, I only get this terminal output:

user@machine:/home/projects$ python breakout_test.py
[2017-05-01 16:36:26,621] Making new env: Breakout-v0

No game window appears and there’s no visual feedback. Has anyone encountered this issue with WSL? I expected to see the game environment rendered but nothing shows up on screen.

yeah, wsl needs extra setup for GUI apps. try installing an x server like vcxsrv on windows, then set your DISPLAY var in wsl. that worked for me when using gym. good luck!