Rllib multiagent examples are not working

I struggle to find working example on rllib with PettingZooEnv

For example, this one

gives me error

2022-12-12 15:16:53,919	ERROR trial_runner.py:993 -- Trial PG_RockPaperScissors_dbd53_00000: Error processing event.
ray.tune.error._TuneNoNextExecutorEventError: Traceback (most recent call last):
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/tune/execution/ray_trial_executor.py", line 1050, in get_next_executor_event
    future_result = ray.get(ready_future)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/_private/worker.py", line 2291, in get
    raise value
ray.exceptions.RayActorError: The actor died because of an error raised in its creation task, ray::PG.__init__() (pid=25099, ip=192.168.31.157, repr=PG)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/algorithms/algorithm.py", line 414, in __init__
    super().__init__(config=config, logger_creator=logger_creator, **kwargs)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/tune/trainable/trainable.py", line 161, in __init__
    self.setup(copy.deepcopy(self.config))
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/algorithms/algorithm.py", line 524, in setup
    self.workers = WorkerSet(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/worker_set.py", line 185, in __init__
    self._local_worker = self._make_worker(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/worker_set.py", line 892, in _make_worker
    worker = cls(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/rollout_worker.py", line 567, in __init__
    self.policy_dict = _determine_spaces_for_multi_agent_dict(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/rollout_worker.py", line 2121, in _determine_spaces_for_multi_agent_dict
    raise ValueError(
ValueError: `observation_space` not provided in PolicySpec for default_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!

2022-12-12 15:16:53,923	ERROR ray_trial_executor.py:111 -- An exception occurred when trying to stop the Ray actor:Traceback (most recent call last):
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/tune/execution/ray_trial_executor.py", line 102, in _post_stop_cleanup
    ray.get(future, timeout=timeout)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/_private/worker.py", line 2291, in get
    raise value
ray.exceptions.RayActorError: The actor died because of an error raised in its creation task, ray::PG.__init__() (pid=25099, ip=192.168.31.157, repr=PG)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/algorithms/algorithm.py", line 414, in __init__
    super().__init__(config=config, logger_creator=logger_creator, **kwargs)
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/tune/trainable/trainable.py", line 161, in __init__
    self.setup(copy.deepcopy(self.config))
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/algorithms/algorithm.py", line 524, in setup
    self.workers = WorkerSet(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/worker_set.py", line 185, in __init__
    self._local_worker = self._make_worker(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/worker_set.py", line 892, in _make_worker
    worker = cls(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/rollout_worker.py", line 567, in __init__
    self.policy_dict = _determine_spaces_for_multi_agent_dict(
  File "/home/student/anaconda3/envs/rllib/lib/python3.8/site-packages/ray/rllib/evaluation/rollout_worker.py", line 2121, in _determine_spaces_for_multi_agent_dict
    raise ValueError(
ValueError: `observation_space` not provided in PolicySpec for default_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!

Single-agent algorithms work perfectly.

Hey @james116blue , the rock paper scissors example is part of the CI tests, so it is definitely passing. I have also confirmed it on my end. I suspect the issue is due to a version mismatch issue, What is your ray, gym and pettingzoo version?

Mine is ray@master, gym==0.26.0, pettingzoo==1.22.1. You can find the requirement here. (but remember to go to the correct release branch first to read the correct versions.)

I get the same error in a single agent custom environment using gymnasium.