Repository: google-deepmind/meltingpot
Issue: MeltingPot examples do not work
Root cause: Configuration Error

The examples need to be updated to ensure they can run.

Currently there are dependency conflicts in the MeltingPot `examples/requirements.txt` 

```
stable-baselines3 2.2.1 requires gymnasium<0.30,>=0.28.1, but you have gymnasium 0.26.3 which is incompatible.
supersuit 3.9.2 requires gymnasium>=0.28.1, but you have gymnasium 0.26.3 which is incompatible.
pettingzoo 1.24.3 requires gymnasium>=0.28.0, but you have gymnasium 0.26.3 which is incompatible.
``` 

No workaround right now, sorry.

Hi John,

We have a fully working versions of baselines in the [repository](https://github.com/rstrivedi/Melting-Pot-Contest-2023) that we used for the contest and that I'm maintaining. This was created in coordination with Edgar, has been well tested and documented and used by several users.

There are two possible resolutions to this bug:
(i) You can remove the examples folder and point to this new repo in Readme for baselines.
(ii) I can push upstream a portion of that repo (working version lightweight files similar to current examples one - and this was our initial plan) to refresh the examples folder.

Please let me know which sounds good to you and I will do that.

Best,
Rakshit

When I test training, like that:
cd examples/rllib
python self_play_train.py
--------------------------->
Display:
2024-04-02 17:56:17.501082: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/mp_home/examples/rllib/self_play_train.py", line 25, in <module>
    from . import utils
ImportError: attempted relative import with no known parent package

python -m rllib.self_play_train
------------------------------->
2024-04-03 12:35:40.307164: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/mp_home/examples/rllib/self_play_train.py", line 22, in <module>
    from ray.rllib.algorithms import ppo
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/ray/rllib/__init__.py", line 7, in <module>
    from ray.rllib.env.base_env import BaseEnv
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/ray/rllib/env/__init__.py", line 1, in <module>
    from ray.rllib.env.base_env import BaseEnv
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/ray/rllib/env/base_env.py", line 6, in <module>
    from ray.rllib.utils.annotations import Deprecated, DeveloperAPI, PublicAPI
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/ray/rllib/utils/__init__.py", line 6, in <module>
    from ray.rllib.utils.filter import Filter
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/ray/rllib/utils/filter.py", line 11, in <module>
    from ray.rllib.utils.serialization import _serialize_ndarray, _deserialize_ndarray
  File "/home/oeuser/miniconda3/envs/mpnn/lib/python3.11/site-packages/ray/rllib/utils/serialization.py", line 23, in <module>
    old_gym_text_class = getattr(old_gym.spaces, "Text", None)
                                 ^^^^^^^^^^^^^^
AttributeError: module 'gym' has no attribute 'spaces'

I tried to execute it in the Codespaces container of GitHub, but the examples were also not able to be trained.

@rstrivedi I'll see what @duenez wants to do, as he's been handling the examples.

@gogo16888 as you've been finding and as this issue documents, the examples don't work. See Rakshit's comment above for a repo with examples that do work.

I check the baselines of Melting-Pot-Contest-2023, it use ray 2.6.1, but the examples use ray 2.5.0, so if I use the baselines, I need update to ray 2.6.1?  But the install of Melting-Pot-Contest-2023 is not as Melting-Pot 2.2.2, I am not sure.

If possible, please export the yml file for each version for easy verification of various software packages/tools/library versions during installation.

> I check the baselines of Melting-Pot-Contest-2023, it use ray 2.6.1, but the examples use ray 2.5.0, so if I use the baselines, I need update to ray 2.6.1? But the install of Melting-Pot-Contest-2023 is not as Melting-Pot 2.2.2, I am not sure.

Thank you for your message. We're in the process of updating the examples folder in this repository. Once it is done, everything should match and flow seamlessly.

In the meantime, for your question, it is generally recommended to use ray >= 2.6.1 as there were some known issues with the older versions. So, you can use the combination of:

- latest version of melting-pot 2.2.2 (from this repository) 
- either ray 2.6.1 or ray 2.20.0 (the latest version) 
- the baselines code from Melting-Pot-Contest-2023 repository

This combination should work without any errors (I've tested this and it works on our end) but let us know if you hit any issues. I'll post here once the examples folder in this repository is updated.