Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrokenPipeError when running baselines #1192

Open
jimmyyzr opened this issue Nov 13, 2021 · 1 comment
Open

BrokenPipeError when running baselines #1192

jimmyyzr opened this issue Nov 13, 2021 · 1 comment

Comments

@jimmyyzr
Copy link

jimmyyzr commented Nov 13, 2021

I am using MacOS Big Sur version 11.06. I use virtualenv with Python 3.7.9.

I was trying to run this command:

python -m baselines.run --alg=ppo2 --env=PongNoFrameskip-v4 --num_timesteps=1e4 --load_path=~/models/pong_20M_ppo2 --play

And I got the error saying that "Error occured while running `from pyglet.gl import *".
I tried the fix in post #274 and changed the find_framework function in site-packages/pyglet/lib.py to

return '/System/Library/Frameworks/OpenGL.framework/OpenGL'

But it doesn't fix the error.

Below is the whole error log. Any suggestions? I would really appreciate it.

Running trained model
Traceback (most recent call last):
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/__init__.py", line 378, in __getattr__
    return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'get_default'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/gym/envs/classic_control/rendering.py", line 27, in <module>
    from pyglet.gl import *
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/gl/__init__.py", line 239, in <module>
    import pyglet.window
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/window/__init__.py", line 1896, in <module>
    gl._create_shadow_window()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/gl/__init__.py", line 208, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/window/__init__.py", line 501, in __init__
    display = get_platform().get_default_display()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/window/__init__.py", line 1845, in get_default_display
    return pyglet.canvas.get_display()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/canvas/__init__.py", line 77, in get_display
    from pyglet.app import displays
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/app/__init__.py", line 175, in <module>
    event_loop = EventLoop()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/app/base.py", line 119, in __init__
    self.clock = clock.get_default()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/__init__.py", line 384, in __getattr__
    __import__(import_name)
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/clock.py", line 169, in <module>
    _c = pyglet.lib.load_library('c')
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/pyglet/lib.py", line 158, in load_library
    raise ImportError('Library "%s" not found.' % names[0])
ImportError: Library "c" not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/run.py", line 248, in <module>
    main(sys.argv)
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/run.py", line 236, in main
    env.render()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/common/vec_env/vec_env.py", line 167, in render
    return self.venv.render(mode=mode)
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/common/vec_env/vec_env.py", line 114, in render
    self.get_viewer().imshow(bigimg)
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/common/vec_env/vec_env.py", line 136, in get_viewer
    from gym.envs.classic_control import rendering
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/venv/lib/python3.7/site-packages/gym/envs/classic_control/rendering.py", line 34, in <module>
    ''')
ImportError: 
    Error occured while running `from pyglet.gl import *`
    HINT: make sure you have OpenGL install. On Ubuntu, you can run 'apt-get install python-opengl'.
    If you're running on a server, you may need a virtual frame buffer; something like this should work:
    'xvfb-run -s "-screen 0 1400x900x24" python <your_script.py>'
    
Exception ignored in: <function SubprocVecEnv.__del__ at 0x7ff6f9ead200>
Traceback (most recent call last):
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/common/vec_env/subproc_vec_env.py", line 107, in __del__
    self.close()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/common/vec_env/vec_env.py", line 98, in close
    self.close_extras()
  File "/Users/yzr/Dropbox/UM/Grad/S1/EECS592/FinalProject/DQN-DDPG_Stock_Trading/baselines/baselines/common/vec_env/subproc_vec_env.py", line 91, in close_extras
    remote.send(('close', None))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 404, in _send_bytes
    self._send(header + buf)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 368, in _send
    n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
@DanielTakeshi
Copy link

Use stable-baselines, as baselines is no longer maintained.

https://github.com/hill-a/stable-baselines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants