google-deepmind / meltingpot

A suite of test scenarios for multi-agent reinforcement learning.
Apache License 2.0
582 stars 118 forks source link

Support pip installation of meltingpot #140

Closed jagapiou closed 1 year ago

jagapiou commented 1 year ago

Once dmlab2d is pip installable (https://github.com/deepmind/lab2d/issues/20), we can make Melting Pot pip installable.

elliottower commented 1 year ago

Just FWIW I tried the install dmlab2d script just now and it failed on my intel mac due to some xcode error, but I have dmlab2d installed in a previous virtualenv so I know it's possible to install. Also if you re-run the script it fails because the directory already exists, I think you can do git clone -p or something similar to clone only if it doesn't exist. Pip installation would make these both irrelevant though so I think that's probably the best thing to do, just letting you know in case there are blockers and it can't get done.

elliottower commented 1 year ago

Tested out the pip wheels on my machine and with shimmy and they seem to have some python path issues:

import meltingpot.python
E   ModuleNotFoundError: No module named 'meltingpot.python'

(https://github.com/Farama-Foundation/Shimmy/actions/runs/5618125745/job/15223240313)

I am assuming there are some bugs since the pypi wheels are set for pre-release, just letting you know in case this info helps. I'm also not sure if this is a bug or if I'm just using it incorrectly, but after installing dm_meltingpot if I try to use it with python I get ModuleNotFound errors when trying to do import meltingpot or import dm_meltingpot.

Installing it through our dockerfile allows us to do import meltingpot but not import meltingpot.python (as shown above).

The bizarre thing is, two days ago when we ran CI it all worked fine, but now suddenly things aren't working. I think I may just pin the git clone command in the dockerfile to a specific commit from a few days ago and test that out, but maybe you would know specifically what recent changes may have caused this issue. Python 3.10 seems to be required now but I've changed the versions in that dockerfile accordingly.

jagapiou commented 1 year ago

Hi, I recently made it so it's just import meltingpot so you shouldn't need import meltingpot.python. I plan to drop a new version soon and document all this before pushing a non-dev release to PyPI. Perhaps I should try to keep import meltingpot.python working for backwards compatibility though...

jagapiou commented 1 year ago

Done! See https://pypi.org/project/dm-meltingpot. Please reopen this if there are any problems.

jagapiou commented 1 year ago

NOTE: you might need SYSTEM_VERSION_COMPAT=0 on macOS.

SYSTEM_VERSION_COMPAT=0 pip install dmlab2d
AlorSahoo commented 9 months ago

Hi, I seemed to have minor python path issues. I passed all the pytest --pyargs meltingpot test cases, so the manual install should be OK.

My issue was with running the RLlib example: python self_play_train.py gives a ModuleNotFoundError: No module named 'meltingpot' error. Not too sure if I just needed to set PYTHONPATH/tweak the import or if this was suggestive of a bigger issue? The same sort of thing happens when I try the human_players scripts.

pip list also shows that meltingpost v1.0.0 is installed.