Hi I keep getting the following error after running random_agent.py script:
`
python random_agent.py
INFO: Making new env: CartPole-v0
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
INFO: Creating monitor directory /tmp/random-agent-results
INFO: Starting new video recorder writing to /tmp/random-agent-results/openaigym.video.0.8775.video000000.mp4
DEBUG: Capturing video frame: path=/tmp/random-agent-results/openaigym.video.0.8775.video000000.mp4
DEBUG: Starting ffmpeg with "ffmpeg -nostats -loglevel error -y -r 50 -f rawvideo -s:v 600x400 -pix_fmt rgb24 -i - -vcodec libx264 -pix_fmt yuv420p /tmp/random-agent-results/openaigym.video.0.8775.video000000.mp4"
Unknown encoder 'libx264'
DEBUG: Capturing video frame: path=/tmp/random-agent-results/openaigym.video.0.8775.video000000.mp4
Traceback (most recent call last):
File "random_agent.py", line 43, in <module>
ob, reward, done, _ = env.step(action)
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/gym/wrappers/monitor.py", line 32, in step
done = self._after_step(observation, reward, done, info)
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/gym/wrappers/monitor.py", line 179, in _after_step
self.video_recorder.capture_frame()
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/gym/wrappers/monitoring/video_recorder.py", line 116, in capture_frame
self._encode_image_frame(frame)
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/gym/wrappers/monitoring/video_recorder.py", line 166, in _encode_image_frame
self.encoder.capture_frame(frame)
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/gym/wrappers/monitoring/video_recorder.py", line 301, in capture_frame
self.proc.stdin.write(frame.tobytes())
BrokenPipeError: [Errno 32] Broken pipe
DEBUG: Closing video encoder: path=/tmp/random-agent-results/openaigym.video.0.8775.video000000.mp4
ERROR: VideoRecorder encoder exited with status 1
DEBUG: Writing training manifest file to /tmp/random-agent-results/openaigym.manifest.0.8775.manifest.json
INFO: Finished writing results. You can upload them to the scoreboard via gym.upload('/tmp/random-agent-results')
Exception ignored in: <bound method Viewer.__del__ of <gym.envs.classic_control.rendering.Viewer object at 0x7f72c083a470>>
Traceback (most recent call last):
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 143, in __del__
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 62, in close
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 480, in close
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 345, in destroy
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/pyglet/gl/base.py", line 334, in destroy
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 335, in detach
File "/home/user/miniconda3/envs/tf/lib/python3.6/site-packages/pyglet/gl/lib.py", line 97, in errcheck
ImportError: sys.meta_path is None, Python is likely shutting down
I have the same issue. Any hints?
Nope basically I gave up but people have said that if you install python=3.5.2 then probably most of the things will work out of the box. Personally I'm waiting support for 3.6.x
Thanks for your hint. I tried it also with 3.5.2 - with no further success.
@DanielsCode there's also another option which is to use gym version=0.9.x alongside with mujoco version 1.3 python 2.7.x. Then remember to use from the examples for instance humanoid-v1 and not humannoid-v2. Others have reported that for them it worked. Dunno, maybe give it a try.
I am experiencing the same issue. Has anyone found a solution?
I am experiencing the same issue. Has anyone found a solution?
try this:
conda install -c conda-forge ffmpeg
for more information
Thank you for the response! Unfortunately, the problem seems to be persisting.
I had the same problem and it seemed to go away by removing the ffmpeg installed on anaconda with conda remove ffmpeg and then build ffmpeg on the system following these instructions:
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Good luck!
Hi, I know this doesn't solve the problem, but I used a screen recorder as a work-around. (E.g. powerpoint, quicktime player screen recording) Hope this helps you move along.
It looks like https://github.com/openai/gym/blob/master/gym/wrappers/monitoring/video_recorder.py depends on some ffmpeg features. It's likely that this should use imageio along with imageio-ffmpeg to get consistent results across multiple platforms which may or may not have the correct ffmpeg installed.
There would need to be a PR to replace the backend used by video_recorder.py I think
Closing this in favor of https://github.com/openai/gym/issues/1470 for now people should use @fantaa499's workaround
I am experiencing the same issue. Has anyone found a solution?
try this:
conda install -c conda-forge ffmpegfor more information
It worked :). Thanks a lot for saving time and effort.
Most helpful comment
try this:
conda install -c conda-forge ffmpegfor more information