openai / retro

Retro Games in Gym
MIT License
3.39k stars 526 forks source link

Playback_Movie: [WinError 2] The system cannot find the file specified #263

Closed BrVerheijen closed 1 year ago

BrVerheijen commented 2 years ago

Issue summary

Our group is creating a Super Mario Kart Snes Reinforcement Learning AI for school. We have been able to create the ai, but for clarity and insight we wanted to be able to show people how the ai playes the game. The problem is the "playback_movie.py" script won't work on our systems. Everyone gets the same error and we can't find any useful information on this error appearing in known issues. I know this repository isn't being maintained anymore, but we hoped we would be able to get some help. I've added the errors we get below.

concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\process.py", line 239, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\process.py", line 198, in _process_chunk
    return [fn(*args) for args in chunk]
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\process.py", line 198, in <listcomp>
    return [fn(*args) for args in chunk]
  File "C:\Users\bramv\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\retro\scripts\playback_movie.py", line 221, in _play    playback_movie(emulator, m, monitor_csv, video_file, info_file, npy_file, args.viewer, delay, args.lossless, not args.no_audio)
  File "C:\Users\bramv\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\retro\scripts\playback_movie.py", line 66, in playback_movie
    ffmpeg_proc = subprocess.Popen(['ffmpeg', '-y',
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1311, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\bramv\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\retro\scripts\playback_movie.py", line 268, in <module>
    main()
  File "C:\Users\bramv\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\retro\scripts\playback_movie.py", line 262, in main 
    list(pool.map(_play, *zip(*[(movie, args, monitor_csv) for movie in args.movies])))
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\process.py", line 484, in _chain_from_iterable_of_lists
    for element in iterable:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\_base.py", line 619, in result_iterator
    yield fs.pop().result()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\_base.py", line 444, in result
    return self.__get_result()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\_base.py", line 389, in __get_result
    raise self._exception
FileNotFoundError: [WinError 2] The system cannot find the file specified

We are running the command like this python -m retro.scripts.playback_movie ./movies/SuperMarioKart-Snes-MarioCircuit_M-000000.bk2. Where the current folder has the movies folder within itself.

We know the .bk2 files are not corrupted, because they work just fine in the gym retro intergration UI. But using screen recording software instead of the script intended to make the movies seems a bit counterintuitive. This would also be a problem because it adds an extra complexity for future groups to progress this project further. Our group has run out of ideas on how to fix this (We've tried changing pieces of the code but to no avail). Thanks in advance for your time and effort, we really appreciate it.

System information

chrisatanasian commented 1 year ago

I had a similar issue and figured it out. I was missing ffmpeg. I had to download it from here, then add it to my PATH environment variable. After that, everything worked fine.