Adding new environment


I want to create my own environment. I followed every step on this web But when i tried to run it. I got the error message:

Traceback (most recent call last):
File “”, line 2, in
import gym
File “/Users/dxzhu/Documents/Gitedepo/gym/gym/”, line 53, in
from gym.scoreboard.api import upload
File “/Users/dxzhu/Documents/Gitedepo/gym/gym/scoreboard/”, line 195, in
File “/Users/dxzhu/Documents/Gitedepo/gym/gym/scoreboard/”, line 40, in add_task
KeyError: ‘my_collection’

Can anyone help me with that?



I’m experiencing the same issue. Did you solve it since then?

Thanks in advance,


I am experiencing the same issue too. Anybody have pointers?


Here’s the preferred way to create one’s own environment:

  1. Create the file structure (somewhere outside of gym) as mentioned on the page referenced by zdx66536, under How to create new environments for Gym.

  2. The instructions forget to fill in gym-foo/gym_foo/envs/ Make it look the same as, except change the class name to FooExtraHardEnv.

  3. cd into gym-foo and run:

    pip install -e .
  4. Modify to make it behave as you wish.

  5. Then use it as follows:

    import gym
    import gym_foo
    env = gym.make('foo-v0')

Please let me know if something goes wrong.