Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
timf34 opened this issue Jul 17, 2022 · 7 comments

Comments

@timf34
Copy link

timf34 commented Jul 17, 2022

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
Copy link
Member

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
Copy link
Author

timf34 commented Jul 18, 2022

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
Copy link
Author

timf34 commented Jul 18, 2022

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

@jjshoots
Copy link
Member

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
Copy link
Author

timf34 commented Jul 19, 2022

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
Copy link
Member

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

@timf34
Copy link
Author

timf34 commented Jul 19, 2022

Sounds good:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants