title: How to use a custom Openai gym environment with Openai stable-baselines RL algorithms?
body: <p>I've been trying to use a custom openai gym environment for fixed wing uav from <a href="https://github.com/eivindeb/fixed-wing-gym" rel="nofollow noreferrer">https://github.com/eivindeb/fixed-wing-gym</a> by testing it with the openai stable-baselines algorithms but I have been running into issues for several days now. My baseline is the CartPole example <strong>Multiprocessing: Unleashing the Power of Vectorized Environments</strong> from <a href="https://stable-baselines.readthedocs.io/en/master/guide/examples.html#multiprocessing-unleashing-the-power-of-vectorized-environments" rel="nofollow noreferrer">https://stable-baselines.readthedocs.io/en/master/guide/examples.html#multiprocessing-unleashing-the-power-of-vectorized-environments</a> since I would need to supply arguments and I am trying to use multiprocessing which I believe this example is all I need.</p>
  
  <p>I have modified the baseline example as follows:</p>
  
  <pre><code>import gym
  import numpy as np
  
  from stable_baselines.common.policies import MlpPolicy
  from stable_baselines.common.vec_env import SubprocVecEnv
  from stable_baselines.common import set_global_seeds
  from stable_baselines import ACKTR, PPO2
  from gym_fixed_wing.fixed_wing import FixedWingAircraft
  
  
  def make_env(env_id, rank, seed=0):
      """
      Utility function for multiprocessed env.
  
      :param env_id: (str) the environment ID
      :param num_env: (int) the number of environments you wish to have in subprocesses
      :param seed: (int) the inital seed for RNG
      :param rank: (int) index of the subprocess
      """
  
      def _init():
          env = FixedWingAircraft("fixed_wing_config.json")
          #env = gym.make(env_id)
          env.seed(seed + rank)
          return env
  
      set_global_seeds(seed)
      return _init
  
  if __name__ == '__main__':
      env_id = "fixed_wing"
      #env_id = "CartPole-v1"
      num_cpu = 4  # Number of processes to use
      # Create the vectorized environment
      env = SubprocVecEnv([lambda: FixedWingAircraft for i in range(num_cpu)])
      #env = SubprocVecEnv([make_env(env_id, i) for i in range(num_cpu)])
  
      model = PPO2(MlpPolicy, env, verbose=1)
      model.learn(total_timesteps=25000)
  
      obs = env.reset()
      for _ in range(1000):
          action, _states = model.predict(obs)
          obs, rewards, dones, info = env.step(action)
          env.render()
  </code></pre>
  
  <p>and the error I keep getting is the following:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/fixed-wing-gym/gym_fixed_wing/ACKTR_fixedwing.py", line 38, in &lt;module&gt;
      model = PPO2(MlpPolicy, env, verbose=1)
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/stable-baselines/stable_baselines/ppo2/ppo2.py", line 104, in __init__
      self.setup_model()
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/stable-baselines/stable_baselines/ppo2/ppo2.py", line 134, in setup_model
      n_batch_step, reuse=False, **self.policy_kwargs)
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/stable-baselines/stable_baselines/common/policies.py", line 660, in __init__
      feature_extraction="mlp", **_kwargs)
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/stable-baselines/stable_baselines/common/policies.py", line 540, in __init__
      scale=(feature_extraction == "cnn"))
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/stable-baselines/stable_baselines/common/policies.py", line 221, in __init__
      scale=scale)
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/stable-baselines/stable_baselines/common/policies.py", line 117, in __init__
      self._obs_ph, self._processed_obs = observation_input(ob_space, n_batch, scale=scale)
    File "/home/bonie/PycharmProjects/deepRL_fixedwing/stable-baselines/stable_baselines/common/input.py", line 51, in observation_input
      type(ob_space).__name__))
  NotImplementedError: Error: the model does not support input space of type NoneType
  </code></pre>
  
  <p>I am not sure what to really input as the <code>env_id</code> and for the <code>def make_env(env_id, rank, seed=0)</code> function. I am also thinking that the <code>VecEnv</code> function for parallel processes is not properly setup. </p>
  
  <p>I am coding with Python v3.6 using PyCharm IDE in Ubuntu 18.04.</p>
  
  <p>Any suggestions would really help at this point!</p>
  
  <p>Thank you. </p>