ganyariya / gym-md

MiniDungeons for OpenAI Gym
MIT License
3 stars 2 forks source link

Bugfix/fix breaking change caused by gym 0.24.1 new passive env checker #28

Closed LJArendse closed 2 years ago

LJArendse commented 2 years ago

Overview

Fix breaking bug caused by gym==0.24.1

The current version of gym-md (gym-md==0.5.1) is breaking due changes introduced in the latest gym version 0.24.1 (i.e. gym==0.24.1). Version 0.24.1 of gym was released approximately 10 days ago. As part of the version 0.24.1 change a new environment (env) checker was introduced (source: https://github.com/openai/gym/releases/tag/0.24.1).

Please see Issue: https://github.com/ganyariya/gym-md/issues/27

Changes Made:

Test output:

========================================================== test session starts ===========================================================
platform darwin -- Python 3.8.9, pytest-7.1.2, pluggy-1.0.0
rootdir: /***/***/gym-md
collected 20 items                                                                                                                       

tests/envs/test_change_rewards.py .                                                                                                [  5%]
tests/envs/test_config.py ...                                                                                                      [ 20%]
tests/envs/test_grid.py .                                                                                                          [ 25%]
tests/envs/test_gym.py ..                                                                                                          [ 35%]
tests/envs/test_path.py ..                                                                                                         [ 45%]
tests/envs/test_random.py .                                                                                                        [ 50%]
tests/envs/test_read_holmgard_gym.py ...                                                                                           [ 65%]
tests/envs/test_setting.py .                                                                                                       [ 70%]
tests/envs/agents/test_agent.py ......                                                                                             [100%]

============================================================ warnings summary ============================================================
tests/envs/test_change_rewards.py::test_change_rewards
tests/envs/test_gym.py::test_gym_run
tests/envs/test_gym.py::test_gym_previous_hp
tests/envs/test_random.py::test_is_same_random
tests/envs/test_read_holmgard_gym.py::test_read_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_large_gym
  /***/***/.local/share/virtualenvs/gym-md-rAeMHdRv/lib/python3.8/site-packages/gym/utils/passive_env_checker.py:97: UserWarning: WARN: We recommend you to use a symmetric and normalized Box action space (range=[-1, 1]) https://stable-baselines3.readthedocs.io/en/master/guide/rl_tips.html
    logger.warn(

tests/envs/test_gym.py::test_gym_run
tests/envs/test_read_holmgard_gym.py::test_read_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_large_gym
  /***/***/.local/share/virtualenvs/gym-md-rAeMHdRv/lib/python3.8/site-packages/gym/utils/passive_env_checker.py:216: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator. 
    logger.warn(

tests/envs/test_gym.py::test_gym_run
tests/envs/test_read_holmgard_gym.py::test_read_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_large_gym
  /***/***/.local/share/virtualenvs/gym-md-rAeMHdRv/lib/python3.8/site-packages/gym/utils/passive_env_checker.py:228: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `return_info` to return information from the environment resetting.
    logger.warn(

tests/envs/test_gym.py::test_gym_run
tests/envs/test_read_holmgard_gym.py::test_read_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_gym
tests/envs/test_read_holmgard_gym.py::test_read_constant_holmgard_large_gym
  /***/***/.local/share/virtualenvs/gym-md-rAeMHdRv/lib/python3.8/site-packages/gym/utils/passive_env_checker.py:233: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information.
    logger.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================================== 20 passed, 19 warnings in 3.02s =====================================================
ganyariya commented 2 years ago

Oh..., a new version OpenAI gym is released! (I did not know new gym version). Your fix is so good, thank you very much! (I did not specify packages (gym, pydantic, ...))

ganyariya commented 2 years ago

I upload 0.5.2 version your PR version, Thankyou!

LJArendse commented 2 years ago

@ganyariya Awesome, thanks for the help and the new release 🥇