OpenAI Gym is a platform for reinforcement learning research that aims to provide a general-intelligence benchmark with a wide variety of environments.
Questions tagged [openai-gym]
1033 questions
98
votes
2 answers
How to create a new gym environment in OpenAI?
I have an assignment to make an AI Agent that will learn to play a video game using ML. I want to create a new environment using OpenAI Gym because I don't want to use an existing environment. How can I create a new, custom Environment?
Also, is…

Rifat Bin Reza
- 2,601
- 2
- 14
- 29
98
votes
14 answers
How to run OpenAI Gym .render() over a server
I am running a python 2.7 script on a p2.xlarge AWS server through Jupyter (Ubuntu 14.04). I would like to be able to render my simulations.
Minimal working example
import gym
env = gym.make('CartPole-v0')
env.reset()
env.render()
env.render()…

Toke Faurby
- 5,788
- 9
- 41
- 62
44
votes
5 answers
OpenAI Gym Atari on Windows
I'm having issues installing OpenAI Gym Atari environment on Windows 10. I have successfully installed and used OpenAI Gym already on the same system.
It keeps tripping up when trying to run a makefile.
I am running the command pip install…

dant
- 687
- 1
- 6
- 15
38
votes
1 answer
OpenAI Gym: Understanding `action_space` notation (spaces.Box)
I want to setup an RL agent on the OpenAI CarRacing-v0 environment, but before that I want to understand the action space. In the code on github line 119 says:
self.action_space = spaces.Box( np.array([-1,0,0]), np.array([+1,+1,+1])) # steer, gas,…

Toke Faurby
- 5,788
- 9
- 41
- 62
31
votes
4 answers
Openai gym environment for multi-agent games
Is it possible to use openai's gym environments for multi-agent games? Specifically, I would like to model a card game with four players (agents). The player scoring a turn starts the next turn. How would I model the necessary coordination between…

Martin Studer
- 2,213
- 1
- 18
- 23
29
votes
3 answers
openAi-gym NameError
I am trying to use the famous 'Gym' module from OpenAI on WSL and executing code on python 3.5.2.
When I try to run an environment as explained here, using the code:
import gym
env = gym.make('CartPole-v0')
for i_episode in range(20):
…

Suprabhat
- 323
- 4
- 8
28
votes
4 answers
How to render OpenAI gym in google Colab?
I'm trying to use OpenAI gym in google colab. As the Notebook is running on a remote server I can not render gym's environment.
I found some solution for Jupyter notebook, however, these solutions do not work with colab as I don't have access to the…

SiaFahim
- 411
- 1
- 5
- 7
27
votes
6 answers
NameError: name 'base' is not defined OpenAI Gym
[Note that I am using xvfb-run -s "-screen 0 1400x900x24" jupyter notebook]
I try to run a basic set of commands in OpenAI Gym
import gym
env = gym.make("CartPole-v0")
obs = env.reset()
env.render()
but I get the following…

midawn98
- 401
- 1
- 4
- 8
22
votes
1 answer
Difference between OpenAI Gym environments 'CartPole-v0' and 'CartPole-v1'
I can't find an exact description of the differences between the OpenAI Gym environments 'CartPole-v0' and 'CartPole-v1'.
Both environments have seperate official websites dedicated to them at (see 1 and 2), though I can only find one code without…

Paul Pauls
- 710
- 1
- 4
- 19
22
votes
3 answers
Display OpenAI gym in Jupyter notebook only
I want to play with the OpenAI gyms in a notebook, with the gym being rendered inline.
Here's a basic example:
import matplotlib.pyplot as plt
import gym
from IPython import display
%matplotlib inline
env = gym.make('CartPole-v0')
env.reset()
for…

MasterScrat
- 7,090
- 14
- 48
- 80
20
votes
3 answers
List all environment id in openai gym
How to list all currently registered environment IDs (as they are used for creating environments) in openai gym?
A bit context: there are many plugins installed which have customary ids such as atari, super mario, doom etc.
Not to be confused with…

Zuoanqh
- 942
- 4
- 10
- 26
16
votes
6 answers
Error in importing environment OpenAI Gym
I am trying to run an OpenAI Gym environment however I get the following error:
import gym
env = gym.make('Breakout-v0')
ERROR
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ale_py/gym/environment.py:11:…

gapansi99
- 187
- 1
- 1
- 7
15
votes
5 answers
Install pybox2d for python 3.6 with conda 4.3.21
i want to play with the lunar lander env from OpenAI gym.
In order to run this code I need to install Box2d, this is where my problems arise.
I am using ubuntu 16.04 with conda 4.3.21 and python 3.6.
When I tried to run the environment I received…

R. M
- 161
- 1
- 1
- 6
14
votes
2 answers
Why is episode done after 200 time steps (Gym environment MountainCar)?
When using the MountainCar-v0 environment from OpenAI-gym in Python the value done will be true after 200 time steps. Why is that? Because the goal state isn't reached, the episode shouldn't be done.
import gym
env =…

needRhelp
- 2,948
- 2
- 24
- 48
13
votes
2 answers
ImportError: Can't find framework /System/Library/Frameworks/OpenGL.framework
I am trying to run this simple gym example on the new macOs Big Sur.
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
env.close()
However, I…

PeeteKeesel
- 634
- 1
- 7
- 18