I am following this [Reinforcement Learning] (https://www.youtube.com/watch?v=2eeYqJ0uBKE) tutorial and facing a very odd issue;
In the last section of the tutorial, when the env is being rendered after loading the model, the env seems to work and is being displayed well in the tutorial above.However, while trying to replicate the same (after In [20]), I am unable to see any new window being opened up and cannot see any error as well in my jupyter notebook, i.e. the code is being executed but no window is being displayed/rendered which shows the env running.
The code :
# Start the game
state = env.reset()
# Loop through the game
while True:
action, _ = model.predict(state)
state, reward, done, info = env.step(action)
env.render()
Now, fun fact is this that when trying to render the env in an earlier step (after [In 26]), the window is being displayed and the game also seems to work well:
How do I make the game render after loading the PPO model i.e. in the "Test it out" section as it is clearly visible that the code is running fine but it's just that the env window is not being rendered.
The only visible difference that I was able to find b/w the tutorial and my program was this warning after running the last cell:
"UserWarning: You tried to call render() but no render_mode
was passed to the env constructor.
warnings.warn("You tried to call render() but no render_mode
was passed to the env constructor.")". Maybe that is making any difference.
I have researched a lot regarding this issue on stack overflow and github as well but can't seem to find any possible solution.
Also, while replicating this issue, keep in mind to use the following versions for most of the packages: (following are the versions which I am using-same as the tutorial)
### gym-super-mario-bros==7.3.0
### nes-py==8.1.8
### gym==0.25.1
### stable-baselines3==2.1.0
### pyglet==1.5.0
### opencv-python==4.8.0.76
I believe that mostly the issue is arising due to some or other version mismatching of some package with one-another. I would be willing to follow up actively if any more information is needed. I have been stuck here for quite a few days and would really really appreciate any help.It would mean a lot. Thanks.
Edit : For anyone trying o replicate the same, here is the entire code on Github