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

NotImplementedError: Calling seed externally is deprecated; call reset(seed=seed) instead #168

Closed timf34 closed 2 years ago

timf34 commented 2 years ago

Hi,

When I run the below sample code from the README.md file, I get the following error: NotImplementedError: Calling seed externally is deprecated; call reset(seed=seed) instead

This is the code sample that I run:

from stable_baselines3 import PPO
from pettingzoo.butterfly import pistonball_v6
import supersuit as ss
env = pistonball_v6.parallel_env()
env = ss.color_reduction_v0(env, mode='B')
env = ss.resize_v0(env, x_size=84, y_size=84)
env = ss.frame_stack_v1(env, 3)
env = ss.pettingzoo_env_to_vec_env_v1(env)
env = ss.concat_vec_envs_v1(env, 8, num_cpus=4, base_class='stable_baselines3')
model = PPO('CnnPolicy', env, verbose=3, n_steps=16)
model.learn(total_timesteps=2000000)

I am using this with supersuit==3.3.3 and pettingzoo==1.8.1

I should also note that I am using gym==0.21.0 (this is the latest version stable-baselines3 is compatible with)

I should also note that there is a similar issue here however that was inactive and had been closed without being resolved.

Thanks

Here is the full traceback:


Traceback (most recent call last):
  File "C:/Users/timf3/PycharmProjects/SSD2/run_scripts/testing_supersuit.py", line 11, in <module>
    env = ss.concat_vec_envs_v1(env, 8, num_cpus=4, base_class='stable_baselines3')
  File "C:\Users\timf3\PycharmProjects\SSD2\venv\lib\site-packages\supersuit\vector\vector_constructors.py", line 49, in concat_vec_envs_v1
    vec_env = MakeCPUAsyncConstructor(num_cpus)(*vec_env_args(vec_env, num_vec_envs))
  File "C:\Users\timf3\PycharmProjects\SSD2\venv\lib\site-packages\supersuit\vector\constructors.py", line 20, in constructor
    example_env = env_fn_list[0]()
  File "C:\Users\timf3\PycharmProjects\SSD2\venv\lib\site-packages\supersuit\vector\vector_constructors.py", line 11, in env_fn
    env.seed(None)
  File "C:\Users\timf3\PycharmProjects\SSD2\venv\lib\site-packages\supersuit\vector\markov_vector_wrapper.py", line 32, in seed
    self.par_env.seed(seed)
  File "C:\Users\timf3\PycharmProjects\SSD2\venv\lib\site-packages\supersuit\generic_wrappers\utils\shared_wrapper_util.py", line 89, in seed
    super().seed(seed)
  File "C:\Users\timf3\PycharmProjects\SSD2\venv\lib\site-packages\pettingzoo\utils\env.py", line 251, in seed
    "Calling seed externally is deprecated; call reset(seed=seed) instead"
NotImplementedError: Calling seed externally is deprecated; call reset(seed=seed) instead
jjshoots commented 2 years ago

Hiya, unfortunately this is part of the SB3/Gym/SS/PZ incompatibility soup. We are actively working on bringing everything up to speed, and much of the focus so far has been placed on reducing the technical debt in Gym. For now, the workaround is to try upgrading SS to the latest version (3.5.0) and seeing if that error still persists. Would you mind reporting back if it does?

timf34 commented 2 years ago

Hi, Yep so what I am now doing is running it on WSL2. I found another issue where you thankfully commented your setup which I have now copied, and is working despite warnings regarding conflicts:) I am running Windows 10 otherwise, and am not sure why but it would not work on that, but with WSL2 it passes. I might also add ray[rllib] into that incompatibility soup, as that also depends on an old version of gym and is what the codebase I am working on is built out of. But yeah 13_lines.py passes when using WSL and the setup you guys posted in the comment above. Thanks for your work! Tim

timf34 commented 2 years ago

Just to be clear, it works on WSL, not on Windows, even when I upgrade to supersuit==3.5.0

jjshoots commented 2 years ago

That's interesting, Windows is not officially supported by these few libraries (in large part because the developers behind them are predominantly Linux/OSX users).

However, if you're able to figure out how to get it to work on Windows, we'd happily work with you on a PR to get it implemented.

timf34 commented 2 years ago

Sounds good!

Getting it working on Windows is not a priority for me at the moment and am just going to continue ahead with WSL for now - but I might come back to it to work on that in a while! Thanks

jjshoots commented 2 years ago

Ok, no problem. Is it safe for me to close this issue?

timf34 commented 2 years ago

Sounds good:)