iglu-contest / gridworld

A reinforcement learning environment for the IGLU 2022 at NeurIPS
GNU Affero General Public License v3.0
32 stars 12 forks source link

Data visualizer video export bug on Mac OS #38

Open chrism-qmul opened 1 year ago

chrism-qmul commented 1 year ago

See pull request https://github.com/iglu-contest/gridworld/pull/37 for possible fix.

Data visualizer video export doesn't work on Mac OS. Throws error regarding FFMPEG, but output file isn't created, so FFMPEG is throwing an error related to the lack of video content. This actually appears to be that image rendering dimensions do not match that of video, so no file is written by cv2. This is in turn likely a consequence of HiDPI.

Steps to reproduce:

pip install git+https://github.com/iglu-contest/gridworld.git@master 
export IGLU_HEADLESS=0
mkdir out
python -m gridworld.data.adapter --render --outpath out --session 1-c118 

  0%|                                                                                                                                                                                | 0/1 [00:00<?, ?
[out#0/mp4 @ 0x60000246c3c0] Output file does not contain any stream
  0%|                                                                                                                                                                                | 0/1 [00:05<?, ?it/s]
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/private/tmp/gridworld/env/lib/python3.9/site-packages/gridworld/data/adapter/__main__.py", line 35, in <module>
    runner(overwrite=args.overwrite, adapt=args.adapt, render=args.render, visualize=args.visualize,
  File "/private/tmp/gridworld/env/lib/python3.9/site-packages/gridworld/data/adapter/adapter.py", line 165, in run
    adapter.render_session_video(
  File "/private/tmp/gridworld/env/lib/python3.9/site-packages/gridworld/data/adapter/adapter.py", line 112, in render_session_video
    visualizer.postproc_video(session_path / f'{session.name}_{i // 2 - 1}')
  File "/private/tmp/gridworld/env/lib/python3.9/site-packages/gridworld/visualizer.py", line 108, in postproc_video
    raise ValueError('Install the latest version of ffmpeg')
ValueError: Install the latest version of ffmpeg