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 game names for atari-py.
Use envs.registry.all()
:
from gym import envs
print(envs.registry.all())
Out:
dict_values([EnvSpec(Copy-v0), EnvSpec(RepeatCopy-v0), EnvSpec(ReversedAddition-v0), EnvSpec(ReversedAddition3-v0), EnvSpec(DuplicatedInput-v0), EnvSpec(Reverse-v0), EnvSpec(CartPole-v0), ...])
This returns a large collection of EnvSpec
objects, not specifically of the IDs as you asked. You can get those like this:
from gym import envs
all_envs = envs.registry.all()
env_ids = [env_spec.id for env_spec in all_envs]
print(sorted(env_ids))
Out:
['Acrobot-v1', 'Ant-v2', 'Ant-v3', 'BipedalWalker-v3', 'BipedalWalkerHardcore-v3', 'Blackjack-v1', 'CarRacing-v0', 'CartPole-v0', 'CartPole-v1', ...]