Skip to content

Fix Taxi-v3 deprecation in tests (gymnasium 1.3.0 compatibility)#2247

Merged
araffin merged 6 commits into
DLR-RM:masterfrom
JonathanColetti:fix-taxi-v3-deprecation
May 2, 2026
Merged

Fix Taxi-v3 deprecation in tests (gymnasium 1.3.0 compatibility)#2247
araffin merged 6 commits into
DLR-RM:masterfrom
JonathanColetti:fix-taxi-v3-deprecation

Conversation

@JonathanColetti
Copy link
Copy Markdown
Contributor

@JonathanColetti JonathanColetti commented Apr 30, 2026

Description

Created function _make_env_safe(env_id, **kwargs) to check if there exists a gym.error.DeprecatedEnv. If said exception exists it checks the fallback hash map and if the env_id exists in the hash map then it uses that version else it raises an exception.

Motivation and Context

It fixes the error gymnasium.error.DeprecatedEnv: Environment version v3 for 'Taxi' is deprecated. Please use 'Taxi-v4' instead.

In the test file test_spaces.py:

Specifically tests/test_spaces.py::test_discrete_obs_space

closes #2246

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

  • 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 change)
  • Documentation (update in the documentation)

Checklist

  • I've read the CONTRIBUTION guide (required)
  • I have updated the changelog accordingly (docs/misc/changelog.md) (required).
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have opened an associated PR on the SB3-Contrib repository (if necessary)
  • I have opened an associated PR on the RL-Zoo3 repository (if necessary)
  • I have reformatted the code using make format (required)
  • I have checked the codestyle using make check-codestyle and make lint (required)
  • I have ensured make pytest and make type both pass. (required)
  • I have checked that the documentation builds using make doc (required)

@JonathanColetti
Copy link
Copy Markdown
Contributor Author

Also just so you are aware when using make commit-checks there exists three errors:

stable_baselines3/common/logger.py:433: error: "None" has no attribute "add_summary"  [attr-defined]
stable_baselines3/common/logger.py:434: error: "None" has no attribute "add_summary"  [attr-defined]
stable_baselines3/common/logger.py:435: error: "None" has no attribute "add_summary"  [attr-defined]
Found 3 errors in 1 file (checked 95 source files)

unrelated to my pull request.

Removed it from deprecations
Copy link
Copy Markdown
Member

@araffin araffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks =)

@araffin araffin merged commit 40da841 into DLR-RM:master May 2, 2026
4 checks passed
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.

[Bug]: Gymnasium deprecated env (Taxi-v3)

2 participants