{"id":24829,"library":"wgpu","title":"wgpu","description":"WebGPU for Python: a Python implementation of the WebGPU API, enabling modern GPU compute and rendering on multiple backends (Vulkan, Metal, D3D12, OpenGL). Current version 0.31.0. Requires Python >=3.10. Releases roughly monthly.","status":"active","version":"0.31.0","language":"python","source_language":"en","source_url":"https://github.com/pygfx/wgpu-py","tags":["gpu","webgpu","compute","graphics"],"install":[{"cmd":"pip install wgpu","lang":"bash","label":"latest stable"}],"dependencies":[],"imports":[{"note":"Incorrect: wgpu.backend.wgpu_native was removed; use wgpu.request_adapter instead.","wrong":"import wgpu.backend.wgpu_native","symbol":"request_adapter","correct":"from wgpu import request_adapter"},{"note":"Wrong: gui module names changed. Use gui.auto (or specific backend like gui.glfw) to get a canvas.","wrong":"from wgpu.gui import WgpuCanvas","symbol":"GUI","correct":"from wgpu.gui.auto import WgpuCanvas"}],"quickstart":{"code":"import wgpu\nimport wgpu.backends.wgpu_native  # triggers auto backend selection\n\nadapter = wgpu.request_adapter(canvas=None, power_preference=\"high-performance\")\ndevice = adapter.request_device(required_features=[])\nprint(f\"Adapter: {adapter.summary}\")\nprint(f\"Device: {device.summary}\")","lang":"python","description":"Initialize wgpu, request adapter and device. In real usage, provide a canvas from wgpu.gui."},"warnings":[{"fix":"Replace `from wgpu.backend.wgpu_native import ...` with `import wgpu` and use `wgpu.request_adapter`.","message":"Import path changed in v0.10.0: previously `import wgpu.backend.wgpu_native` is no longer needed; use `import wgpu` and call `wgpu.request_adapter()`.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Change import to `from wgpu.gui.auto import WgpuCanvas`.","message":"GUI canvas module restructured in v0.15.0: `from wgpu.gui import WgpuCanvas` no longer works; use `from wgpu.gui.auto import WgpuCanvas`.","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Install appropriate GPU drivers or test with `wgpu.request_adapter` to see available adapters.","message":"The `wgpu` library bundles wgpu-native binaries. On some platforms (e.g., Linux without Vulkan drivers) it may fall back to OpenGL or silently fail. Test on target hardware.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `import wgpu` and call `wgpu.request_adapter()` instead.","cause":"Importing from `wgpu.backend` which was removed in v0.10.0.","error":"ModuleNotFoundError: No module named 'wgpu.backend'"},{"fix":"Use `adapter = wgpu.request_adapter(...)` then `device = adapter.request_device(...)`.","cause":"API changed; `create_device_with_swap_chain` was removed in favor of `request_adapter` + `request_device`.","error":"AttributeError: module 'wgpu' has no attribute 'create_device_with_swap_chain'"},{"fix":"Install extra dependencies: `pip install wgpu[gui]` and use `from wgpu.gui.auto import WgpuCanvas`.","cause":"GUI backends moved to `wgpu.gui.auto` or specific named modules like `wgpu.gui.glfw` may not be installed by default.","error":"wgpu.gui.glfw.GlfwCanvas not found (import fails)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}