Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load gridworld-v0 environment

I m trying to perform reinforcement learning algorithms on the gridworld environment but i can't find a way to load it.

I have successfully installed gym and gridworld 0.14.0 then I executed this command

env = gym.make("gridworld-v0")

I then obtained the following error stack

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in spec(self, path)
    131         try:
--> 132             return self.env_specs[id]
    133         except KeyError:

KeyError: 'gridworld-v0'

During handling of the above exception, another exception occurred:

UnregisteredEnv                           Traceback (most recent call last)
<ipython-input-36-b3991c5b334f> in <module>
----> 1 env = gym.make("gridworld-v0")
      2 env.setPlan("gridworldPlans/plan1.txt", {0: -0.001, 3: 1, 4: 1, 5: -1, 6: -1})
      3 statedic, mdp = env.getMDP()

~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in make(id, **kwargs)
    154 
    155 def make(id, **kwargs):
--> 156     return registry.make(id, **kwargs)
    157 
    158 def spec(id):

~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in make(self, path, **kwargs)
     98         else:
     99             logger.info('Making new env: %s', path)
--> 100         spec = self.spec(path)
    101         env = spec.make(**kwargs)
    102         # We used to have people override _reset/_step rather than

~/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py in spec(self, path)
    140                 raise error.DeprecatedEnv('Env {} not found (valid versions include {})'.format(id, matching_envs))
    141             else:
--> 142                 raise error.UnregisteredEnv('No registered env with id: {}'.format(id))
    143 
    144     def register(self, id, **kwargs):

UnregisteredEnv: No registered env with id: gridworld-v0

I d expect it to be enough to load the environment but it is apparently enough.

Could you please advice me on how to proceed?

Cheers, Paul

like image 929
P.Champ Avatar asked Sep 17 '25 07:09

P.Champ


1 Answers

Should be in Caps:

env = gym.make('Gridworld-v0')

Further reference: https://pypi.org/project/gym-gridworlds/

like image 128
malcubierre Avatar answered Sep 19 '25 09:09

malcubierre