keiohta / tf2rl

TensorFlow2 Reinforcement Learning
MIT License
461 stars 104 forks source link

Fix: DeprecatedEnv error for Pendulum-v0 #155

Closed ymd-h closed 2 years ago

ymd-h commented 2 years ago

This PR is for issue #154.

Pendulum-v0 is deprecated at Gym 0.21.0 and gym.make raises gym.error.DeprecatedEnv.

Since TensorFlow 0.8.0 (for TensorFlow 2.0/2.1) is incompatible with Gym 0.21.0, we cannot increase dependent Gym version.

This commit includes following workaround.

Add a wrapper function tf2rl.envs.utils.make: Find latest version from registered environments when DeprecatedEnv is raised.

gym.make does not check version number when rasing gym.error.DeprecatedEnv.

If we pass a future version like "Pendulum-v1000", gym.make still raises gym.error.DeprecatedEnv, so that incremental version check can fall into infinit loop.

keiohta commented 2 years ago

Hi @ymd-h , thanks for dealing with the error I mentioned in #153 !