I have a script where I try to use stable_baselines3.__version__='2.0.0a5'
methods over a custom Gym environment. The thing is that, even if my environment does inherit from the gym.Env class, I get the error AssertionError: Your environment must inherit from the gym.Env class cf https://github.com/openai/gym/blob/master/gym/core.py
This is how my environment is instantiated:
import gym
class v1(gym.Env):
"""
GYM functions
"""
def __init__(self):
super().__init__()
# My implementation of the rest of the class here
And this is how I try to use it before it fails
gym_env = v1()
print("Check env: ")
check_env(gym_env)
From the Changelog, it is stated that Stable Baselines 2.0.0a8 (at the time of writing)
switched to Gymnasium as primary backend, Gym 0.21 and 0.26 are still supported via the
shimmy
package
I would consider using Gymnasium
when using Stable Baselines 3 version > 2.0.0, or switch to an older version of Stable Baselines 3 (<2.0.0) to use the old Gym
, or you could use the shimmy
package as suggested if you want to look into that.