import ray
import gymnasium as gym
from ray import tune
from ray.rllib.algorithms import ppo, sac
from ray.rllib.agents.ppo import PPOTrainer
from envs.hunter import Hunter, Hunter_config
from ray.tune import register_env
#ray.shutdown()
#ray.init(ignore_reinit_error=True)
def env_creater(Hunter_config):
return Hunter(config=Hunter_config)
register_env("hunter", env_creater)
trainer = PPOTrainer(env="hunter")
what this error is basically telling you is that, if you want to use an environment with RLlib you can only do so, if the environment inherits from a certain class (with classes listed in the error).
So you might either want to inherit from the gym environment (this is the easiest way, but not always possible) or inherit from a class given by the RLlib module itself, e.g. the ExternalEnv in case your environment does pull actions in and push observations out like in some external simulators.
See here for some more information about the environments in RLlib. See here for some examples.