# Error with Waterworld v4 (Pettingzoo)

**URL:** <https://discuss.ray.io/t/error-with-waterworld-v4-pettingzoo/8496>\
**Category:** RLlib\
**Created:** [December 1, 2022, 2:02am UTC](https://discuss.ray.io/t/error-with-waterworld-v4-pettingzoo/8496 "2022-12-01T02:02:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![george\_sk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/george_sk/32/3496_2.png) [@george\_sk](https://discuss.ray.io/u/george_sk)\
**Post date:** [December 1, 2022, 2:02am UTC](https://discuss.ray.io/t/error-with-waterworld-v4-pettingzoo/8496/1 "2022-12-01T02:02:06Z")

</div>

**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’

```auto
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 github.com/parametersharingmadrl/parametersharingmadrl

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)

    tune.Tuner(
        "APEX_DDPG",
        run_config=air.RunConfig(
            stop={"episodes_total": 60000},
            checkpoint_config=air.CheckpointConfig(
                checkpoint_frequency=10,
            ),
        ),
        param_space={
            # 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),
            },
        },
    ).fit()

```

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.

Thanks

---

<div class="post-metadata">

**Author:** ![george\_sk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/george_sk/32/3496_2.png) [@george\_sk](https://discuss.ray.io/u/george_sk)\
**Post date:** [December 8, 2022, 2:52pm UTC](https://discuss.ray.io/t/error-with-waterworld-v4-pettingzoo/8496/2 "2022-12-08T14:52:04Z")

</div>

Hi, I also notice that on the pistonball exampe for pettingzoo [https://github.com/Farama-Foundation/PettingZoo/blob/master/tutorials/Ray/rllib\_pistonball.py](https://github.com/Farama-Foundation/PettingZoo/blob/master/tutorials/Ray/rllib_pistonball.py), 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.  
Thanks
