PettingZoo can not use with rllib

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

  • High: It blocks me to complete my task.

These are my software versions:
Ray 1.13.0
PettingZoo 1.20.1
supersuit 3.5.0
gym 0.25.1
And I run the demo and failed.

The output shows below:

Traceback (most recent call last):
  File "", line 3, in <module>
    from ray.rllib.env.wrappers.pettingzoo_env import ParallelPettingZooEnv
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/", line 5, in <module>
    from ray.rllib.env.base_env import BaseEnv
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/env/", line 6, in <module>
    from ray.rllib.env.policy_client import PolicyClient
  File "/home/xzk/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/env/", line 16, in <module>
    from ray.rllib.policy.sample_batch import MultiAgentBatch
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/policy/", line 6, in <module>
    from ray.rllib.policy.tf_policy_template import build_tf_policy
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/policy/", line 7, in <module>
    from ray.rllib.policy import eager_tf_policy
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/policy/", line 12, in <module>
    from ray.rllib.evaluation.episode import Episode
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/evaluation/", line 2, in <module>
    from ray.rllib.evaluation.rollout_worker import RolloutWorker
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/evaluation/", line 30, in <module>
    from ray.rllib.env.utils import record_env_wrapper
  File "/anaconda3/envs/PettingZoo/lib/python3.7/site-packages/ray/rllib/env/", line 59, in <module>
    class VideoMonitor(wrappers.Monitor):
AttributeError: module 'gym.wrappers' has no attribute 'Monitor'

And I also try the demo in Ray project and failed again. The same error comes out.

What can I do to run demo without error?

pip install -I gym==0.23

I try it and nothing changed. :thinking:

Sorry, my bad. Try installing gym 0.22.0 instead.

1 Like