Keyerror when trying to run triangle.py
Closed this issue · 2 comments
Mats-Janssens commented
File "/home/mats/CLONES/wgpu-py/examples/triangle.py", line 146, in <module>
main(canvas)
File "/home/mats/CLONES/wgpu-py/examples/triangle.py", line 68, in main
return _main(canvas, device)
File "/home/mats/CLONES/wgpu-py/examples/triangle.py", line 137, in _main
draw_frame = setup_draw(canvas.get_context(), device)
File "/home/mats/CLONES/wgpu-py/examples/triangle.py", line 88, in setup_draw
render_pipeline = device.create_render_pipeline(
File "/home/mats/VENV/sim/lib/python3.10/site-packages/wgpu/backends/wgpu_native/_api.py", line 1427, in create_render_pipeline
for buffer_des in vertex["buffers"]:
KeyError: 'buffers'
Segmentation fault (core dumped)
I have just pip install wgpu and glfw on a fresh linux mint install where the proper nvidia drivers are installed. I dont think I need to install any glfw or wgpu official binaries because they should be included in the respective wheels so I dont understand what is going wrong. Thank you very much in advance for your help on this issue.
Korijn commented
I'll explain the situation to you with two observations from your issue report:
- Looking at your stack trace, it seems like you have cloned the repo, so you are probably running the example code from the latest development commit on the main branch
- You also mention you have installed wgpu from pip, so that's the last release, not the latest development commit
See the problem?
You have two options to resolve (pick one):
- Checkout the commit from the repo that matches the version you installed with pip (
git checkout v0.16.0
if that is the version you installed) - Uninstall the version you installed with pip (
pip uninstall wgpu
) and setup a development environment so you can run the latest development commit code, instructions can be found here: https://github.com/pygfx/wgpu-py?tab=readme-ov-file#developers
almarklein commented
What Korijn said. The buffers
field is no longer required in the latest version. The example has been updated to demonstrate this, but this means that the latest version of the example no longer works on the older version of wgpu-py :)