mimoralea / gdrl

Grokking Deep Reinforcement Learning
https://www.manning.com/books/grokking-deep-reinforcement-learning
BSD 3-Clause "New" or "Revised" License
812 stars 234 forks source link

Code for GIF in chapter 8 is not running #26

Closed ghost closed 2 years ago

ghost commented 2 years ago

I tried to run the code from Chapter 8 with no success. Not only forced to downgrade the gym version to 0.22.0 due to deprecation of gym.wrappers.Monitor(), but also best_agent.demo_progression() function, which is supposed to generate GIFs, got stucked in the subprocess.Popen() part with the following error. Is there any solution to this?

`FileNotFoundError                         Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12908/1650199322.py in <module>
----> 1 best_agent.demo_progression()

~\AppData\Local\Temp/ipykernel_12908/1002205623.py in demo_progression(self, title, max_n_videos)
    216 
    217         env.close()
--> 218         data = get_gif_html(env_videos=env.videos, 
    219                             title=title.format(self.__class__.__name__),
    220                             subtitle_eps=sorted(checkpoint_paths.keys()),

~\AppData\Local\Temp/ipykernel_12908/3674493635.py in get_gif_html(env_videos, title, subtitle_eps, max_n_videos)
     13         gif_path = basename + '.gif'
     14         if not os.path.exists(gif_path):
---> 15             ps = subprocess.Popen(
     16                 ('ffmpeg', 
     17                  '-i', video_path,

~\anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
    949                             encoding=encoding, errors=errors)
    950 
--> 951             self._execute_child(args, executable, preexec_fn, close_fds,
    952                                 pass_fds, cwd, env,
    953                                 startupinfo, creationflags, shell,

~\anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
   1418             # Start the process
   1419             try:
-> 1420                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1421                                          # no special security
   1422                                          None, None,

FileNotFoundError:  [WinError 2] The system cannot find the file specified]
mimoralea commented 2 years ago

Use the provided docker container, it has very specific packages installed and ready to go.