--- id: py3nvml version: "0.2.7" license: BSD license_treatment: permissive maintenance: abandoned --- # py3nvml — Python 3 Bindings for the NVIDIA Management Library License: permissive · Maintenance: abandoned · Downloads: 192.5K/mo ## What it is and what it does py3nvml is a Python 3 port of NVIDIA's official python bindings to the NVIDIA Management Library (NVML), allowing you to query GPU state, driver info, memory usage, and running processes programmatically. It wraps the C NVML library and raises Python exceptions instead of returning error codes, making it more Pythonic than the original C interface. Beyond basic NVML queries, the package includes utility functions for shared GPU server scenarios: grab_gpus() automatically sets CUDA_VISIBLE_DEVICES to allocate a specified number of free GPUs based on memory thresholds, get_free_gpus() detects which GPUs have no running processes, and a py3smi command-line tool provides formatted GPU status output. These utilities address the practical problem of preventing greedy frameworks from monopolizing all available GPUs. Use it for: - Automatically allocate N free GPUs to a job on a shared multi-GPU server without manual CUDA_VISIBLE_DEVICES configuration. - Monitor GPU memory usage and process counts programmatically to implement custom GPU scheduling or load-balancing logic. - Query driver version, GPU model names, and memory capacity at runtime to validate hardware requirements before launching compute jobs. - Implement a health-check or monitoring script that detects hung GPU processes or memory leaks across a cluster of machines. - Build a web dashboard or CLI tool that displays formatted GPU status with custom metrics or filtering. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Python 3 bindings to query NVIDIA GPU state and manage GPU visibility for multi-GPU systems via the NVIDIA Management Library. No—the package is abandoned (last release 2021-11-22, last commit 2022-04-14) and will not track NVIDIA driver or CUDA API changes. For new projects, use actively maintained alternatives. If you have legacy code already using py3nvml, it may still work on older systems, but do not adopt it for new development. ## Install pip install py3nvml uv add py3nvml poetry add py3nvml ## Installing py3nvml Before you install: Low install friction with a single lightweight dependency (xmltodict). However, the package is abandoned—last release was 2021-11-22 and last commit 2022-04-14, with no active maintenance or security updates. License in practice: BSD license is permissive and imposes minimal restrictions; you can use, modify, and distribute the package freely with attribution. Quickstart: pip install py3nvml from py3nvml.py3nvml import * nvmlInit() print("Driver Version: {}".format(nvmlSystemGetDriverVersion())) deviceCount = nvmlDeviceGetCount() nvmlShutdown() Requires NVIDIA GPU hardware and NVIDIA drivers installed; NVIDIA Management Library (libnvidia-ml.so or equivalent) must be accessible on the system. Verify before relying: - Compatibility with NVIDIA driver versions and CUDA toolkits released after 2022-04-14. - Whether xmltodict dependency is actually used at runtime or only for optional nvidia_smi module functionality. - Support status for Python versions beyond 3.5 (classifiers list only 3.5 explicitly). ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 192.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags nvidia gpu query python, cuda visible devices management, gpu memory monitoring, nvml python bindings, shared gpu server allocation, gpu process detection, nvidia driver info python, gpu-management, nvidia-hardware, abandoned [View on SkillFed](https://skillfed.io/packages/py3nvml) · [View on PyPI](https://pypi.org/project/py3nvml/)