Error with Waterworld v4 (Pettingzoo)

How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

Hi, I am using the waterworld environment and tried to update my code on the latest releases, so when I try the parameter sharing or independent learning examples from the documentation I get a deprecation error because the examples use waterworld.v3, but when I try to use waterworld.v4 I get the following error. (for the independent learning case)

line 33, in
“policies”: set(env.agents),
AttributeError: ‘PettingZooEnv’ object has no attribute ‘agents’

from ray import air, tune
from ray.tune.registry import register_env
from ray.rllib.env.wrappers.pettingzoo_env import PettingZooEnv
from pettingzoo.sisl import waterworld_v4

# Based on code from

if __name__ == "__main__":
    # RDQN - Rainbow DQN
    # ADQN - Apex DQN
    def env_creator(args):
        return PettingZooEnv(waterworld_v4.env())

    env = env_creator({})
    register_env("waterworld", env_creator)

            stop={"episodes_total": 60000},
            # Enviroment specific
            "env": "waterworld",
            # General
            "num_gpus": 0,
            "num_workers": 2,
            # Method specific
            "multiagent": {
                "policies": set(env.agents),
                "policy_mapping_fn": (lambda agent_id, episode, **kwargs: agent_id),

With parameter sharing and waterworld.v4 I get

ValueError: observation_space not provided in PolicySpec for shared_policy and env does not have an observation space OR no spaces received from other workers’ env(s) OR no observation_space specified in config!

I use the latest ray 2.1.0 on on Ubuntu 20.04. I usually use PPO but I tried it and has the same errors. Do you know if the examples are outdated so they don’t work with the current version or it is a fault of the environment.


Hi, I also notice that on the pistonball exampe for pettingzoo, it is referred that there are bugs as a warning, so I wanted to ask if I should declare the waterworld problem as a bug or I am doing something wrongly.

I would appreciate any help.