nvidia-ml-py
Python Bindings for the NVIDIA Management Library
What it is and what it does
nvidia-ml-py is a ctypes-based wrapper that translates NVIDIA's C Management Library (NVML) into Python methods and classes. It handles struct allocation, pointer passing, and converts NVML error codes into Python exceptions, making GPU queries and monitoring accessible from Python without direct C bindings.
The library exposes the NVML API surface—driver version queries, device enumeration, memory info, temperature, power state, and other hardware metrics. It converts C output parameters into Python return values and C structs into Python objects with named attributes. Since its first release in 2012, it has tracked NVML versions through version 13.580, supporting both Python 2 and Python 3 syntax.
Use it for:
- Query GPU memory usage and availability for resource allocation in ML training or inference pipelines.
- Monitor driver version and GPU device names at application startup for compatibility checks.
- Build system monitoring dashboards that poll GPU temperature, power draw, or utilization metrics.
- Validate GPU availability and count before launching GPU-accelerated workloads.
- Implement health checks in containerized environments to detect GPU driver or hardware failures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python wrapper around NVIDIA's Management Library that exposes GPU monitoring and management functions through a Pythonic interface, converting C library calls to Python methods and error codes to exceptions.
Yes. This is a stable, dependency-free wrapper to a critical system library with no known vulnerabilities, active maintenance, and broad adoption (top 5000 PyPI packages). Install it if you need to query or monitor NVIDIA GPUs from Python; the only blocker is requiring NVIDIA drivers and NVML on the target system.
Install
nvidia-ml-py on PyPI
pip
pip install nvidia-ml-pyuv
uv add nvidia-ml-pypoetry
poetry add nvidia-ml-pyInstalling nvidia-ml-py
Before you install
Low friction installation as a pure wheel with no runtime dependencies. Actively maintained with a release 74 days ago and production-stable status.
License in practice
BSD permissive license allows commercial and private use with minimal restrictions—retain copyright notice and disclaimer in redistributions.
Quickstart
pip install nvidia-ml-py
from nvidia_ml_py import *
nvmlInit()
deviceCount = nvmlDeviceGetCount()
for i in range(deviceCount):
handle = nvmlDeviceGetHandleByIndex(i)
print(nvmlDeviceGetName(handle))
nvmlShutdown()
Requires NVIDIA GPU drivers and NVML library installed on the system; will fail if neither is present.
Verify before relying
- Exact Python version support (documentation mentions 2.5+ with ctypes, but requires_python is unspecified)
- Whether ctypes is available in all target Python environments
- Compatibility with non-NVIDIA GPUs or virtualized GPU environments
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 74 days since the last release |
| First released | |
| Downloads | 21,045,134/month — #1,015 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nvidia_ml_py-13.610.43-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
nvidia-ml-py3Provides Python bindings to NVIDIA's Management…
permissive · top 15,000 on PyPI
py3nvmlProvides Python 3 bindings to query NVIDIA GPU…
permissive · top 15,000 on PyPI
nvitopInteractive terminal-based viewer for NVIDIA…
copyleft · top 15,000 on PyPI
pycudaPyCUDA provides Pythonic bindings to Nvidia's…
permissive · top 15,000 on PyPI
gpustatDisplays real-time NVIDIA GPU status, memory…
permissive · top 5,000 on PyPI
cuda-pythoncuda-python is a metapackage providing Pythonic…
unclear · top 5,000 on PyPI
cufile-pythonProvides a Python wrapper around the NVIDIA…
permissive · top 15,000 on PyPI
nccl4pynccl4py provides Python bindings to NVIDIA's…
permissive · top 15,000 on PyPI
nvidia-nvvmProvides the NVVM compiler IR library for…
unclear · top 5,000 on PyPI