qlib icon indicating copy to clipboard operation
qlib copied to clipboard

fix: migrate from gym to gymnasium for NumPy 2.0+ compatibility

Open ishanrajsingh opened this issue 2 months ago • 1 comments

  • Replace gym dependency with gymnasium (maintained drop-in replacement)
  • Update all gym imports to use gymnasium
  • Add proper error handling for missing gymnasium dependency
  • Add lazy loading of gymnasium in backtest module
  • Fix hard crashes when using NumPy 2.0+

Fixes #2018

Description

Motivation and Context

How Has This Been Tested?

  • [x] Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • [x] If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • [x] Fix bugs
  • [ ] Add new feature
  • [ ] Update documentation

ishanrajsingh avatar Sep 26 '25 15:09 ishanrajsingh

@microsoft-github-policy-service agree

ishanrajsingh avatar Sep 26 '25 15:09 ishanrajsingh