Farama-Foundation / SuperSuit

A collection of wrappers for Gymnasium and PettingZoo environments (being merged into gymnasium.wrappers and pettingzoo.wrappers
Other
446 stars 56 forks source link

Calling seed externally is deprecated; call reset(seed=seed) instead #160

Closed erickrf closed 2 years ago

erickrf commented 2 years ago

I'm trying to run this tutorial code, but when I run the line with ss.concat_vec_envs_v1, I get this error:

File ~/.local/share/virtualenvs/rl-0i49mzF7/lib/python3.9/site-packages/supersuit/vector/vector_constructors.py:49, in concat_vec_envs_v1(vec_env, num_vec_envs, num_cpus, base_class)
     47 def concat_vec_envs_v1(vec_env, num_vec_envs, num_cpus=0, base_class='gym'):
     48     num_cpus = min(num_cpus, num_vec_envs)
---> 49     vec_env = MakeCPUAsyncConstructor(num_cpus)(*vec_env_args(vec_env, num_vec_envs))
     51     if base_class == "gym":
     52         return vec_env

File ~/.local/share/virtualenvs/rl-0i49mzF7/lib/python3.9/site-packages/supersuit/vector/constructors.py:20, in MakeCPUAsyncConstructor.<locals>.constructor(env_fn_list, obs_space, act_space)
     19 def constructor(env_fn_list, obs_space, act_space):
---> 20     example_env = env_fn_list[0]()
     21     envs_per_env = getattr(example_env, "num_envs", 1)
     23     num_fns = len(env_fn_list)

File ~/.local/share/virtualenvs/rl-0i49mzF7/lib/python3.9/site-packages/supersuit/vector/vector_constructors.py:11, in vec_env_args.<locals>.env_fn()
      9 def env_fn():
     10     env_copy = cloudpickle.loads(cloudpickle.dumps(env))
---> 11     env.seed(None)
     12     return env_copy

File ~/.local/share/virtualenvs/rl-0i49mzF7/lib/python3.9/site-packages/supersuit/vector/markov_vector_wrapper.py:32, in MarkovVectorEnv.seed(self, seed)
     31 def seed(self, seed=None):
---> 32     self.par_env.seed(seed)

File ~/.local/share/virtualenvs/rl-0i49mzF7/lib/python3.9/site-packages/supersuit/generic_wrappers/utils/shared_wrapper_util.py:89, in shared_wrapper_parr.seed(self, seed)
     88 def seed(self, seed=None):
---> 89     super().seed(seed)
     90     for agent, mod in sorted(self.modifiers.items()):
     91         mod.seed(seed)

File ~/.local/share/virtualenvs/rl-0i49mzF7/lib/python3.9/site-packages/pettingzoo/utils/env.py:250, in ParallelEnv.seed(self, seed)
    246 def seed(self, seed=None):
    247     """
    248     Reseeds the environment (making it deterministic).
    249     """
--> 250     raise NotImplementedError(
    251         "Calling seed externally is deprecated; call reset(seed=seed) instead"
    252     )

NotImplementedError: Calling seed externally is deprecated; call reset(seed=seed) instead
jjshoots commented 2 years ago

Hiya, apologies for taking awhile to see this. Are you trying to run this code from the PyPI release with the associating PettingZoo PyPI release? Or is this error happening with the gh branch of code?

jkterry1 commented 2 years ago

Hey, I'm going to close this due to inactivity, please let us know if you have any additional help :)

KevinJeon commented 2 years ago

Hi, I am getting the same error with and I am ss.concat_vec_envs_v1

I have a

SuperSuit 3.3.3 PettingZoo 1.18.1

timf34 commented 2 years ago

Hi, I am also getting this same error, also with supersuit==3.3.3 and pettingzoo==1.18.1. Both of which are using the PyPi releases (i.e. they're installed via pip) Thanks