hill-a / stable-baselines

A fork of OpenAI Baselines, implementations of reinforcement learning algorithms
http://stable-baselines.readthedocs.io/
MIT License
4.14k stars 723 forks source link

assertionerror, observation space , vectransposeimage #1185

Open skgr07 opened 1 year ago

skgr07 commented 1 year ago

Important Note: We do not do technical support, nor consulting and don't answer personal questions per email.

If you have any questions, feel free to create an issue with the tag [question].
If you wish to suggest an enhancement or feature request, add the tag [feature request].
If you are submitting a bug report, please fill in the following details.

If your issue is related to a custom gym environment, please check it first using:

from stable_baselines.common.env_checker import check_env
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\stable_baselines3\common\env_checker.py", line 390, in check_env
    assert isinstance(
AssertionError: Your environment must inherit from the gymnasium.Env class cf. https://gymnasium.farama.org/api/env/

Describe the bug I tried to use vectranspose image wrapper, but it returned an error. I think this is a problem of my developing environment, but I cannot specify where the problem is. And I don't know how to inherit from gymnasium env class. is there anyone who can explain? Code example Please try to provide a minimal example to reproduce the bug. Error messages and stack traces are also helpful.

Please use the markdown code blocks for both code and stack traces.

from stable_baselines3 import DQN, A2C, DDPG
from stable_baselines3.common.env_checker import check_env
from stable_baselines3.common.monitor import Monitor
from stable_baselines3.common.vec_env import DummyVecEnv, VecTransposeImage
from stable_baselines3.common.evaluation import evaluate_policy
from stable_baselines3.common.callbacks import EvalCallback
from stable_baselines3.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise
Traceback (most recent call last): File ...
  File "d:\AirSim\End-to-end_Autonomous_Driving_Car_Simulation-main\PythonClient_working\car\reinforcement_learning\rl_car.py", line 37, in <module>
    check_env(env)
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\stable_baselines3\common\env_checker.py", line 390, in check_env
    assert isinstance(
AssertionError: Your environment must inherit from the gymnasium.Env class cf. https://gymnasium.farama.org/api/env/

System Info installed by pip, stable baselines 3 and sb3 contrib by git clone python3.11.4 gym==0.26.2 gym-notices==0.0.8 gymnasium==0.28.1 numpy==1.24.3 oauthlib==3.2.2 opencv-contrib-python==4.8.0.74 sb3-contrib @ git+https://github.com/Stable-Baselines-Team/stable-baselines3-contrib@35f06254ba3a470e8bbe1dff0bfc6f319ee2431a scipy==1.11.1 Shimmy==0.2.1 stable-baselines3 @ git+https://github.com/DLR-RM/stable-baselines3@ba77dd7c6180c0ec9a47dfa98291c2103e6750df sympy==1.12 tensorboard==2.13.0 tensorboard-data-server==0.7.1 tensorflow==2.13.0 tensorflow-estimator==2.13.0 tensorflow-intel==2.13.0 tensorflow-io-gcs-filesystem==0.31.0

Additional context