Registry / serialization / pyglm
library2.8.3pypypi✓ verified 87d ago

PyGLM is an OpenGL Mathematics library for Python, providing vector and matrix types, and mathematical functions for graphics programming. It is a Python extension written in C++ that wraps the popular GLM (OpenGL Mathematics) library. The current version is 2.8.3. It maintains an infrequent but active release cadence, focusing on stability and compatibility with its underlying C++ counterpart.

pip install pyglm
INSTALL
IMPORT
SIG · PYGLM
P
pyglm
serializationpythonv2.8.3
Install
2.5s avg
Import
176ms
Disk
57MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.8.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.172s · 60.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.5s · import 0.179s · 57MB
57MB installed
● package 57MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

glm
import glm
from pyglm import glm (before v2.8), import pyglm
The module is imported as 'glm'. In PyGLM versions 2.7.3 and earlier, 'try: from pyglm import glm except ImportError: import glm' was suggested. Direct 'import glm' is currently the standard but will be deprecated in PyGLM 3.0 in favor of 'from pyglm import glm'.

This quickstart demonstrates basic vector and matrix initialization and operations using the `glm` module. It shows how to create vectors and matrices, access components, and perform arithmetic operations.

import glm # Vector operations v = glm.vec3() v.x = 7 print(f"v.xxy: {v.xxy}") # Matrix initialization m = glm.mat4() print(f"m:\n{m}") # Vector arithmetic with iterables v_sum = glm.vec4(1, 2, 3, 4) + (8, 7, 6, 5) print(f"v_sum: {v_sum}")
Debug
Known issues
breakingThe direct import `import glm` will be deprecated in PyGLM 3.0. Users should transition to `from pyglm import glm` for future compatibility.
fix
Update your import statement from `import glm` to `from pyglm import glm`.
affects: >=3.0 (future)
gotchaPyGLM's syntax differs from the original C++ GLM library in several ways, including using `.` instead of `::` for namespaces (e.g., `glm.vec2`), requiring `_LH` suffix for left-handed coordinate system functions (e.g., `glm.perspectiveLH`), and using default `packed_highp` precision.
fix
Refer to the PyGLM documentation or wiki for specific syntax differences when porting C++ GLM code.
affects: All versions
gotchaCertain functions, like `glm.frexp`, may issue a `UserWarning`. These can be silenced if desired.
fix
Use `glm.silence(ID)` to silence specific warnings, or `glm.silence(0)` to silence all warnings. Check the `glm` module's function reference for warning IDs.
affects: All versions
gotchaThe GLM C++ library, which PyGLM wraps, is licensed under the MIT License. Users are required to include the GLM license (`COPYING` or `GLM_LICENSE` file) in their projects, especially for binary distributions.
fix
Copy the `COPYING` or `GLM_LICENSE` file from the PyGLM source to your project directory.
affects: All versions
Errors
Common errors & fixes
AttributeError: module 'glm' has no attribute 'vec2'
This error typically occurs when the wrong `glm` package has been installed. There is another package named `glm` on PyPI which is a JSON parser, not the OpenGL Mathematics library.
fix
Ensure you installed `pyglm` and not `glm`. Uninstall `glm` (`pip uninstall glm`) and then install the correct package (`pip install pyglm`).
ERROR: Failed building wheel for pyglm
PyGLM is a C++ extension and requires C++ build tools to be present on your system if a pre-compiled wheel is not available for your specific Python version and operating system. On Windows, this often means Visual C++ Build Tools.
fix
On Windows, install the 'Desktop development with C++' workload from the Visual Studio Installer. On Linux, ensure `build-essential` (Debian/Ubuntu) or `Development Tools` (Fedora/RHEL) are installed.
Upgrade
Version history
2.8.3latest on PyPI · released Nov 26, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
Amazon
1
Resources
pyglm — pip install pyglm · libregistry