首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能使用OpenGL >= 3+上下文初始化Pyglet窗口

未能使用OpenGL >= 3+上下文初始化Pyglet窗口
EN

Ask Ubuntu用户
提问于 2020-10-28 11:11:07
回答 1查看 1.8K关注 0票数 1

我把它放到一个没有监视器的远程服务器上,在试图运行脚本时得到了一个错误。

代码语言:javascript
复制
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 ""

下面是完整的错误消息。

代码语言:javascript
复制
(/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 ""

如何使用vglrun运行我的scrpit?我试着搜索vglrun,但没有找到答案。

EN

回答 1

Ask Ubuntu用户

发布于 2020-10-28 13:02:29

https://github.com/nkolot/SPIN/issues/41找到了一个解决方案

添加这一行

代码语言:javascript
复制
os.environ['PYOPENGL_PLATFORM'] = 'egl'
票数 2
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1287639

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档