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
13
votes
2 answers
How to pass arguments to openai-gym environments upon init
Following this (unreadable) forum post, I thought it was fitting to post it up on stack overflow for future generations who search for it.
How to pass arguments for gym environments on init?

Gulzar
- 23,452
- 27
- 113
- 201
13
votes
3 answers
How can I register a custom environment in OpenAI's gym?
I have created a custom environment, as per the OpenAI Gym framework; containing step, reset, action, and reward functions. I aim to run OpenAI baselines on this custom environment. But prior to this, the environment has to be registered on OpenAI…

Mad_Scientist
- 195
- 1
- 1
- 8
13
votes
1 answer
Why can't my DQN agent find the optimal policy in a non-deterministic environment?
edit: The following seems also to be the case for FrozenLake-v0. Please note that I'm not interested in simple Q-learning as I want to see solutions that work with continuous observation spaces.
I recently created the banana_gym OpenAI environment.…

Martin Thoma
- 124,992
- 159
- 614
- 958
12
votes
1 answer
How to implement custom environment in keras-rl / OpenAI GYM?
I'm a complete newbie to Reinforcement Learning and have been searching for a framework/module to easily navigate this treacherous terrain. In my search I've come across two modules keras-rl & OpenAI GYM.
I can get both of them two work on the…

Manipal King
- 422
- 1
- 5
- 18
10
votes
2 answers
OpenAI GYM's env.step(): what are the values?
I am getting to know OpenAI's GYM (0.25.1) using Python3.10 with gym's environment set to 'FrozenLake-v1 (code below).
According to the documentation, calling env.step() should return a tuple containing 4 values (observation, reward, done, info).…

doesnotcompile
- 103
- 1
- 1
- 7
10
votes
1 answer
I'm getting an error with env rendering - env.render()
I was trying to implement Atari Games while rendering I get an error as given below:
line 283, in render
raise error.Error(
gym.error.Error: render(mode='human') is deprecated. Please supply `render_mode` when constructing your environment,…

Natasha
- 351
- 1
- 2
- 10
10
votes
2 answers
OpenAI gym player mode
Does anyone know how to run one of the OpenAI gym environments as a player. As in letting a human player play a round of cart pole? I have seen that there is env.mode = 'human' but I have not been able to get it to run properly. I have tried to…

user3704648
- 349
- 3
- 14
10
votes
1 answer
OpenAI gym mujoco ImportError: No module named 'mujoco_py.mjlib'
I try to run this code in openAi gym. but it can not.
import mujoco_py
import gym
from os.path import dirname
env = gym.make('Hopper-v1')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample())
the error…

Yunfan Lu
- 103
- 1
- 1
- 5
10
votes
2 answers
How to install OpenAI Universe without getting error code 1 on Windows?
When I try to install OpenAi Universe on my Windows machine via python pip I get following stacktrace:
Traceback (most recent call last):
File "", line 1, in
File…

creativecreatorormaybenot
- 114,516
- 58
- 291
- 402
9
votes
2 answers
how to create an OpenAI Gym Observation space with multiple features
Using Python3.6, Ubuntu 18.04, Gym 0.15.4, RoS melodic, Tensorflow 1.14 and rl_coach 1.01:
I have built a custom Gym environment that is using a 360 element array as the observation_space.
high = np.array([4.5] * 360) #360 degree scan to a max of…

learningtofly
- 353
- 1
- 2
- 13
9
votes
1 answer
Why unwrap an openAI gym?
I'm trying to get some insights into reinforcement learning while using openAI gym as a learning environment. I do this by reading the book Hands-on reinforcement learning with Python. In this book, some code is provided. Often, the code doesn't…

Bram Janssens
- 101
- 1
- 4
9
votes
1 answer
Get name / id of a OpenAI Gym environment
Given:
import gym
env = gym.make('CartPole-v0')
How do I get CartPole-v0 in a way that works across any Gym env?

Andrew Schreiber
- 14,344
- 6
- 46
- 53
9
votes
5 answers
Can't import gym; ModuleNotFoundError: No module named 'gym'
Can't import gym;
ModuleNotFoundError: No module named 'gym'

yyt
- 91
- 1
- 1
- 2
9
votes
5 answers
openAI Gym NameError in Google Colaboratory
I've just installed openAI gym on Google Colab, but when I try to run 'CartPole-v0' environment as explained here.
Code:
import gym
env = gym.make('CartPole-v0')
for i_episode in range(20):
observation = env.reset()
for t in range(100):
…

Javier A. Zambrano Macias
- 158
- 1
- 1
- 6
9
votes
1 answer
Error following env.render() for OpenAI
I am trying to get the code below to work.
import gym
env = gym.make("CartPole-v0")
env.reset()
env.render()
I have no problems running the first 3 lines but when I run the 4th I get the error:
Traceback (most recent call last):
File…

MikeDoho
- 552
- 2
- 5
- 18