Closed liznelson closed 1 year ago
I think this should be fixed now, but if it's still a problem with the most recent master release let me know and i can look into it.
Just tested now, it should work:
from pettingzoo.butterfly import pistonball_v6
import pickle
import supersuit as ss
env = pistonball_v6.parallel_env()
env = ss.pettingzoo_env_to_vec_env_v1(env)
env = ss.concat_vec_envs_v1(env, 1, base_class="stable_baselines3")
pickled_env = pickle.dumps(env)
From what I can find, the accepted way of to turn a pettingzoo environment to some thing that can work with stable baselines is with these two functions.
It seems a lot of people report pickle errors if that pettingzoo environment is custom. The suggested fix is to inherit from gym's EzPickle class.
TypeError: cannot pickle '_thread.lock' object
Even when I inherit my environment from EzPickle, I get a new error about cloudpickle needing the env passed in the init.
It seems enough people report this issue that it would be great if there was a parallelpettingzoo_with_ezpickle option to inherit from EzPickle.