I ssh-ed into a remote server that has no monitor and got an error when trying to run a script.
ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was ""
Below is the full error message.
(/home_nfs/haziq/cenvs/hpe) haziq@blender:~/I2L-MeshNet_RELEASE/demo$ python demo.py --gpu 0 --stage param --test_epoch 8 >>> Using GPU: 0
Load checkpoint from ./snapshot_8.pth.tar
Traceback (most recent call last):
File "/home_nfs/haziq/cenvs/hpe/lib/python3.7/site-packages/pyrender/platforms/pyglet_platform.py", line 39, in init_context
width=1, height=1)
File "/home_nfs/haziq/cenvs/hpe/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 173, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/home_nfs/haziq/cenvs/hpe/lib/python3.7/site-packages/pyglet/window/__init__.py", line 603, in __init__
config = screen.get_best_config(config)
File "/home_nfs/haziq/cenvs/hpe/lib/python3.7/site-packages/pyglet/canvas/base.py", line 194, in get_best_config
raise window.NoSuchConfigException()
pyglet.window.NoSuchConfigException
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "demo.py", line 133, in <module>
rendered_img = render_mesh(vis_img, mesh_lixel_cam, face, {'focal': focal, 'princpt': princpt})
File "/home_nfs/haziq/I2L-MeshNet_RELEASE/main/../common/utils/vis.py", line 136, in render_mesh
renderer = pyrender.OffscreenRenderer(viewport_width=img.shape[1], viewport_height=img.shape[0], point_size=1.0)
File "/home_nfs/haziq/cenvs/hpe/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
self._create()
File "/home_nfs/haziq/cenvs/hpe/lib/python3.7/site-packages/pyrender/offscreen.py", line 149, in _create
self._platform.init_context()
File "/home_nfs/haziq/cenvs/hpe/lib/python3.7/site-packages/pyrender/platforms/pyglet_platform.py", line 45, in init_context
'internal error message was "{}"'.format(e)
ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was ""
How do I run my scrpit with vglrun? I tried googling vglrun but found no answers.
Found a solution at https://github.com/nkolot/SPIN/issues/41
Add this line