ValueError: The environment is of type <class '__main__.StockTradingEnvironment'>, not a Gymnasium environment

25 Views Asked by At

When running the code env = DummyVecEnv([lambda: StockTradingEnvironment(stock_data)]), it provides

ValueError: The environment is of type <class '__main__.StockTradingEnvironment'>, not a Gymnasium environment. In this case, we expect OpenAI Gym to be installed and the environment to be an OpenAI Gym environment.

I have already imported the necessary libraries like the following.

import yfinance as yf
import numpy as np
import pandas as pd
from stable_baselines3 import DQN
from stable_baselines3.common.vec_env import DummyVecEnv
from gym import spaces

How to resolve this error?

0

There are 0 best solutions below