Skip to content

[Dependency Upgrade] migrate habitat-lab from gym to gymnasium - #2223

Open
xiaosq2000 wants to merge 1 commit into
facebookresearch:mainfrom
xiaosq2000:dependency-upgrade/gymnasium
Open

[Dependency Upgrade] migrate habitat-lab from gym to gymnasium#2223
xiaosq2000 wants to merge 1 commit into
facebookresearch:mainfrom
xiaosq2000:dependency-upgrade/gymnasium

Conversation

@xiaosq2000

Copy link
Copy Markdown

Motivation and Context

Importing Habitat currently pulls in the unmaintained gym dependency, which emits a warning in modern NumPy environments:

python -c 'import habitat'
Gym has been unmaintained since 2022 and does not support NumPy 2.0 amongst other critical functionality.
Please upgrade to Gymnasium, the maintained drop-in replacement of Gym...

This PR migrates habitat-lab from gym to gymnasium so that importing Habitat no longer emits that warning. The change preserves Habitat's current env IDs and reset/step behavior without a broader public API transition to native gymnasium.

In short:

  • replace gym imports/usages with gymnasium
  • update compatibility points where the APIs differ
  • refresh affected tests, examples, and docs references

How Has This Been Tested

Tested locally with:

  • SKIP=mypy pre-commit run --all-files --hook-stage=manual

Types of changes

  • [Dependency Upgrade] Upgrades one or several dependencies in habitat

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation if required.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes if required.

Gym 0.23 is unmaintained and warns on import with NumPy 2, which makes
this dependency noisy in modern environments and blocks a clean upgrade
path.

Keep Habitat's existing reset/step contracts and registered env IDs in
place so this change is reviewable as a backend dependency swap first.
That keeps baselines, HITL, and GymRegistryEnv users working while a
follow-up can migrate the public API to native Gymnasium semantics.
@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Apr 9, 2026
@xiaosq2000

Copy link
Copy Markdown
Author

Note: the semantic sensor int32/uint32 bounds mismatch that also surfaces with NumPy 2.0+ is addressed in a dedicated PR: #2224.

This PR (#2223) focuses on the gymgymnasium migration per #1213.

@wadeKeith wadeKeith left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Withdrawn; this review was too cursory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants