Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env.reset() crashed in basic usage example #31

Closed
nicklhy opened this issue Sep 7, 2023 · 4 comments
Closed

env.reset() crashed in basic usage example #31

nicklhy opened this issue Sep 7, 2023 · 4 comments

Comments

@nicklhy
Copy link

nicklhy commented Sep 7, 2023

I installed magent2 with pip install magent2 and copy the missing .py files following this issue. Now I can import magent2 envs in python successfully. But when I tried to run the basic usage example as below. It just crashed.

$ python
Python 3.9.0 (default, Nov 15 2020, 14:28:56) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from magent2.environments import battle_v4
>>> env = battle_v4.env(map_size=16, render_mode='human')
>>> env.reset()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/wrappers/order_enforcing.py", line 101, in reset
    super().reset(seed=seed, options=options)
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/wrappers/base.py", line 99, in reset
    self.env.reset(seed=seed, options=options)
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/wrappers/base.py", line 99, in reset
    self.env.reset(seed=seed, options=options)
  File "/home/lhy/.conda/envs/dev/lib/python3.9/site-packages/pettingzoo/utils/conversions.py", line 284, in reset
    self._observations, self.infos = self.env.reset(seed=seed, options=options)
ValueError: too many values to unpack (expected 2)
>>> 

Related lib versions are listed below

$ python -c "import magent2; print(magent2.__version__)"
0.3.2
$ python -c "import pettingzoo; print(pettingzoo.__version__)"
1.23.1
@nicklhy
Copy link
Author

nicklhy commented Sep 7, 2023

After debugging into some source code. I found that magent2/environments/magent_env.py::magent_parallel_env.reset returns a single dict value. This might not be compatible with what pettingzoo expects in the above error msg.

self._observations, self.infos = self.env.reset(seed=seed, options=options)

@jonhoye
Copy link

jonhoye commented Oct 4, 2023

Try:
pip uninstall pettingzoo
pip install pettingzoo==1.22

@nicklhy
Copy link
Author

nicklhy commented Oct 17, 2023

Try: pip uninstall pettingzoo pip install pettingzoo==1.22

Thanks for your reply. Downgrading pettingzoo to 1.22.0 solves my problem.

@Daniel-Huff
Copy link

change dependencies = [ "numpy >=1.21.0", "pygame>=2.1.0", "pettingzoo>=1.22.0", ] worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants