title: Multiprocessing; How to debug: _pickle.PicklingError: Could not pickle object as excessively deep recursion required
body: <p>I have a simulation which I can run using Python code and want to create multiple instances of it using a <code>SubProcVecEnv</code> from <code>stable-baselines3</code>. This uses subprocessing to run the simulations on different cores and it was working before I made a number of changes to my code. However, now I receive the error below and do not know how to debug it, because I don't understand which part of my code is causing it. Is there a way to find out which object/ method is causing the recursion depth being exceeded? I also do not remember writing a recursive method anywhere in my code. Researching the error message was not successful.</p>
  <pre><code>/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/site-packages/gym/logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
  Traceback (most recent call last):
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/site-packages/cloudpickle/cloudpickle_fast.py&quot;, line 563, in dump
      return Pickler.dump(self, obj)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/site-packages/cloudpickle/cloudpickle_fast.py&quot;, line 639, in reducer_override
      if sys.version_info[:2] &lt; (3, 7) and _is_parametrized_type_hint(obj):  # noqa  # pragma: no branch
  RecursionError: maximum recursion depth exceeded in comparison
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File &quot;/home/philipp/Code/ba_pw/train.py&quot;, line 84, in &lt;module&gt;
      venv = utils.make_venv(env_class, network, params, remote_ports, monitor_log_dir)
    File &quot;/home/philipp/Code/ba_pw/sumo_rl/utils/utils.py&quot;, line 170, in make_venv
      return vec_env.SubprocVecEnv(env_fs)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py&quot;, line 106, in __init__
      process.start()
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/multiprocessing/process.py&quot;, line 121, in start
      self._popen = self._Popen(self)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/multiprocessing/context.py&quot;, line 291, in _Popen
      return Popen(process_obj)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/multiprocessing/popen_forkserver.py&quot;, line 35, in __init__
      super().__init__(process_obj)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/multiprocessing/popen_fork.py&quot;, line 19, in __init__
      self._launch(process_obj)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/multiprocessing/popen_forkserver.py&quot;, line 47, in _launch
      reduction.dump(process_obj, buf)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/multiprocessing/reduction.py&quot;, line 60, in dump
      ForkingPickler(file, protocol).dump(obj)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/site-packages/stable_baselines3/common/vec_env/base_vec_env.py&quot;, line 372, in __getstate__
      return cloudpickle.dumps(self.var)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/site-packages/cloudpickle/cloudpickle_fast.py&quot;, line 73, in dumps
      cp.dump(obj)
    File &quot;/home/philipp/anaconda3/envs/sumo_rl/lib/python3.8/site-packages/cloudpickle/cloudpickle_fast.py&quot;, line 570, in dump
      raise pickle.PicklingError(msg) from e
  _pickle.PicklingError: Could not pickle object as excessively deep recursion required.
  </code></pre>