Search code examples
python-3.xopenai-gym

How to solve "Env not found" error in OpenAI Gym?


I am using gym version - '0.9.7', and mujoco_py version 1.50.1.41, Python 3.6.1 |Anaconda 4.4.0, installed on a mac.

When trying:

import gym
env = gym.make('Humanoid-v1')

I am getting the following error:

Traceback (most recent call last):
  File "/Users/usr/gym/gym/envs/registration.py", line 139, in spec
    return self.env_specs[id]
KeyError: 'Humanoid-v1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/usr/gym/gym/envs/registration.py", line 163, in make
    return registry.make(id)
  File "/Users/usr/gym/gym/envs/registration.py", line 118, in make
    spec = self.spec(id)
  File "/Users/usr/gym/gym/envs/registration.py", line 147, in spec
    raise error.DeprecatedEnv('Env {} not found (valid versions include {})'.format(id, matching_envs))
gym.error.DeprecatedEnv: Env Humanoid-v1 not found (valid versions include ['Humanoid-v2'])

I have tried looking for solutions online with no success.


Solution

  • The changelog on gym's front page mentions the following:

    2018-01-24: All continuous control environments now use mujoco_py >= 1.50. Versions have been updated accordingly to -v2, e.g. HalfCheetah-v2. Performance should be similar (see https://github.com/openai/gym/pull/834) but there are likely some differences due to changes in MuJoCo.

    So, if you're using a gym version from that date or later, you'll have to use

    env = gym.make('Humanoid-v2')
    

    instead of v1. If you really really specifically want version 1 (for reproducing previous experiments on that version for example), it looks like you'll have to install an older version of gym and mujoco.