Welcome to the wonderful world of Shimmy, a powerful API conversion tool that enables effortless interactions between popular external reinforcement learning environments like Gymnasium and PettingZoo. In this guide, we’ll navigate through installation, usage, and supported APIs to help you harness the full potential of Shimmy.
Why Use Shimmy?
Shimmy acts as a bridge, converting various environments to be compatible with Gymnasium and PettingZoo frameworks. This feature opens up a range of possibilities for your reinforcement learning applications, allowing you to seamlessly integrate different environments into your projects. Think of it as a universal translator for machine learning environments!
Supported APIs
Shimmy supports a range of APIs, making it a versatile tool for researchers and developers:
- OpenAI Gym – Bindings to convert OpenAI Gym environments to Gymnasium.
- Atari Environments – Bindings for Atari environments from ALE-py.
- DeepMind Control – Conversions for DM Control environments.
- DeepMind Control: Multi-Agent – Conversions for DM Control Soccer environments.
- DMLab – Conversions for DM Lab environments.
- OpenSpiel – Conversions for OpenSpiel environments.
- Behavior Suite – Conversions for Behavior Suite environments.
- Melting Pot – Conversions for Melting Pot environments.
Installation and Usage
Getting started with Shimmy is straightforward. Follow these steps to install and use Shimmy for your projects:
Installation
- To install Shimmy, use the following command from PyPI:
pip install shimmy
pip install shimmy[bsuite, atari]
pip install shimmy[all, testing]
Using Shimmy
Let’s illustrate how to convert DM Control environments into Gymnasium compatible environments. This can be compared to converting a podcast from one language to another so that diverse audiences can enjoy it. Here’s the code that carries out this process:
import gymnasium as gym
from shimmy.registration import DM_CONTROL_SUITE_ENVS
env_ids = [f'dm_control-{item}-v0' for item in DM_CONTROL_SUITE_ENVS]
print(env_ids)
env = gym.make(env_ids[0])
env_flatten = gym.wrappers.FlattenObservation(env)
print(env_ids[0])
print(===, env.observation_space)
print(===, env.action_space)
print(---flattened , env_flatten.observation_space)
print(---flattened , env_flatten.action_space)
In this code snippet:
- We first import necessary libraries.
- We then retrieve environment IDs for DM Control and print them out.
- Next, we create a Gymnasium environment from the first ID and flatten its observation space for easy handling.
- Finally, we output the observation and action spaces before and after flattening.
Example Output
Upon executing the code, expect to see a printed list of available environments followed by the shape and boundaries of their observation and action spaces. This information is critical for setting proper parameters in your projects.
Troubleshooting
If you encounter any issues while installing or using Shimmy, here are some troubleshooting tips:
- Ensure you have the correct version of Python installed.
- Check that all dependencies listed in the installation instructions are included.
- If you experience import errors, verify that Shimmy was successfully installed using PyPI.
- Consult the [documentation](https://shimmy.farama.org) for detailed troubleshooting steps.
- For additional help and community support, consider joining the public Discord server here.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

