Skip to content

Conversation

@itwasabhi
Copy link
Contributor

Description

Gymnasium's gym is a drop-in replacement of open-ai's gym. Some of these gymnasium modules were already being used in this repo as it depends on PettingZoo.

Fixes #152

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Gymnasium's gym is a drop-in replacement of open-ai's gym. Some of these gymnasium modules were already being used in this repo as it depends on PettingZoo.
@micahcarroll
Copy link
Member

@itwasabhi, sadly these changes seem to have broken some of the tests relating to PettingZoo.

@itwasabhi
Copy link
Contributor Author

Yes -- will investigate and ping once ready!

@itwasabhi
Copy link
Contributor Author

@micahcarroll I'm seeing very similar test failures when running tests even before these changes (i.e. 9dfc1e8, cd6739e). Any clue as to why the automated workflow flag those? I dont think the changes here are causing any new test failures (aside from the formatting ones atm)

@itwasabhi
Copy link
Contributor Author

itwasabhi commented Dec 23, 2024

To clarify, its the visualization_test.py that is (and has been) problematic as far as i can tell.

The petting zoo test seems fine when it try to repro:

overcooked_ai/testing$ python overcooked_test.py TestPettingZooEnvironment -v
test_api (__main__.TestPettingZooEnvironment) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.001s

@micahcarroll micahcarroll merged commit 8bbf72e into HumanCompatibleAI:master Feb 1, 2025
3 checks passed
@itwasabhi
Copy link
Contributor Author

Thanks for the fixes!

@itwasabhi itwasabhi deleted the update_to_gymnasium branch February 1, 2025 11:27
@micahcarroll
Copy link
Member

Thank you @itwasabhi! The repo is getting pretty old and it really would benefit from a revamp (e.g. switching to uv from conda, increasing the python version, etc.) 😅

@rajatkb
Copy link

rajatkb commented Mar 27, 2025

Is there any particular version of gymnassium expected since I am facing this issue. Seems gymnasium step function passes extra params to underlying reset method

Traceback (most recent call last):
  File "/home/rajatkb/Work/7642RLDMSpring2025rkb6/project_3/main.py", line 51, in run
    observation, info = env.reset()
                        ^^^^^^^^^^^
  File "/home/rajatkb/ml/lib/python3.11/site-packages/gymnasium/wrappers/common.py", line 400, in reset
    return super().reset(seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rajatkb/ml/lib/python3.11/site-packages/gymnasium/core.py", line 328, in reset
    return self.env.reset(seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rajatkb/ml/lib/python3.11/site-packages/gymnasium/wrappers/common.py", line 293, in reset
    return env_reset_passive_checker(self.env, seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rajatkb/ml/lib/python3.11/site-packages/gymnasium/utils/passive_env_checker.py", line 185, in env_reset_passive_checker
    result = env.reset(**kwargs)
             ^^^^^^^^^^^^^^^^^^^
TypeError: Overcooked.reset() got an unexpected keyword argument 'seed'

@rajatkb
Copy link

rajatkb commented Mar 27, 2025

In case anyone temp fix
just add this in top of the codebase where you import overcooked.

original_reset = Overcooked.reset
Overcooked.reset = lambda self, *args, **kwargs: original_reset(self)

Also happy to fix this unless its not fixed in any of the current releases ?

ahmadad0111 pushed a commit to ahmadad0111/overcooked_ai that referenced this pull request Oct 15, 2025
…nasium

Switch to gymnasium in favor of openai gym
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

Successfully merging this pull request may close these issues.

Awkward gym dependencies

3 participants