pyrender icon indicating copy to clipboard operation
pyrender copied to clipboard

NoneType' object has no attribute 'setView_'

Open huybery opened this issue 5 years ago • 3 comments

Traceback (most recent call last):
  File "/Users/xxx/anaconda3/envs/voca/lib/python3.6/site-packages/pyrender/platforms/pyglet.py", line 32, in init_context
    width=1, height=1)
  File "/Users/xxx/anaconda3/envs/voca/lib/python3.6/site-packages/pyglet/window/__init__.py", line 643, in __init__
    self._create()
  File "/Users/xxx/anaconda3/envs/voca/lib/python3.6/site-packages/pyglet/window/cocoa/__init__.py", line 210, in _create
    self.context.attach(self.canvas)
  File "/Users/xxx/anaconda3/envs/voca/lib/python3.6/site-packages/pyglet/gl/cocoa.py", line 288, in attach
    self._nscontext.setView_(canvas.nsview)
AttributeError: 'NoneType' object has no attribute 'setView_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_training.py", line 92, in <module>
    main()
  File "run_training.py", line 89, in main
    model.train()
  File "/Users/xxx/voca/utils/voca_model.py", line 190, in train
    , data_specifier='training')
  File "/Users/xxx/voca/utils/voca_model.py", line 251, in _render_sequences
    self._render_helper(out_folder, data_specifier)
  File "/Users/xxx/voca/utils/voca_model.py", line 276, in _render_helper
    self._render_sequences_helper(video_fname, raw_audio[i_seq], processed_audio[i_seq], templates[i_seq], vertices[i_seq], condition_idx)
  File "/Users/xxx/voca/utils/voca_model.py", line 310, in _render_sequences_helper
    pred_img = render_mesh_helper(Mesh(predicted_vertices[i_frame], self.template_mesh.f), center)
  File "/Users/xxx/voca/utils/rendering.py", line 107, in render_mesh_helper
    r = pyrender.OffscreenRenderer(viewport_width=frustum['width'], viewport_height=frustum['height'])
  File "/Users/xxx/anaconda3/envs/voca/lib/python3.6/site-packages/pyrender/offscreen.py", line 31, in __init__
    self._create()
  File "/Users/xxx/anaconda3/envs/voca/lib/python3.6/site-packages/pyrender/offscreen.py", line 134, in _create
    self._platform.init_context()
  File "/Users/xxx/anaconda3/envs/voca/lib/python3.6/site-packages/pyrender/platforms/pyglet.py", line 38, 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 "'NoneType' object has no attribute 'setView_'"

Platform MacOS, any help would be appreciated.

huybery avatar Jan 19 '20 03:01 huybery

The same. Did you solve that?

Cindy0401 avatar Feb 08 '20 19:02 Cindy0401

The same. Did you solve that?

no.. It's really a cursing problem.

huybery avatar Feb 09 '20 12:02 huybery

AttributeError: 'NoneType' object has no attribute 'setView_'

I encountered the same problem on Mac OS. The reason that this happened for me was because I was importing pyglet dependencies before pyrender. Importing pyrender first fixes the issue for me. Hope this helps.

winstonww avatar Nov 02 '21 02:11 winstonww