Registry / ai-ml / gputil

gputil

JSON →
library1.4.0pypypi✓ verified 21d ago

GPUtil is a Python module designed to query the status of NVIDIA GPUs using the `nvidia-smi` command-line utility. It provides access to metrics like GPU load, memory usage, temperature, and UUID. The current version is 1.4.0, and releases occur intermittently, focusing on bug fixes, expanded platform support (e.g., Windows), and new features.

pip install GPUtil
INSTALL
IMPORT
SIG · GPUTIL
G
gputil
ai-mlpythonv1.4.0
Install
2.4s avg
Import
367ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.4.0 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.240s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.200s · 20MB
17MB installed
● package 17MB
Code
Verified usage

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

GPUtil
import GPUtil
import GPUtil

This quickstart demonstrates how to import GPUtil and retrieve information for all available NVIDIA GPUs. It iterates through each GPU, printing key metrics like name, load, memory usage, temperature, and UUID. It includes basic error handling for when `nvidia-smi` is not found.

import GPUtil try: gpus = GPUtil.getGPUs() if not gpus: print("No NVIDIA GPUs found or nvidia-smi is not in PATH.") for i, gpu in enumerate(gpus): print(f"--- GPU {i} ---") print(f" Name: {gpu.name}") print(f" Load: {gpu.load * 100:.2f}%") print(f" Memory Total: {gpu.memoryTotal} MB") print(f" Memory Used: {gpu.memoryUsed} MB") print(f" Memory Free: {gpu.memoryFree} MB") print(f" Temperature: {gpu.temperature} °C") print(f" UUID: {gpu.uuid}") except Exception as e: print(f"An error occurred: {e}") print("Please ensure NVIDIA drivers are installed and nvidia-smi is accessible in your system's PATH.")
Debug
Known issues
breakingThe project was renamed from `GPUstats` to `GPUtil` in version 1.2.0. Code using `import GPUstats` or other `GPUstats` specific imports will break.
fix
Update your import statements from `import GPUstats` to `import GPUtil` and adjust any module-specific references accordingly. Ensure your `pip install` command is `pip install GPUtil`.
affects: < 1.2.0
gotchaGPUtil relies on the NVIDIA System Management Interface (`nvidia-smi`) executable. This utility must be installed as part of your NVIDIA display driver package and be accessible within your system's PATH environment variable.
fix
Install the appropriate NVIDIA display drivers for your GPU. Verify `nvidia-smi` is callable from your terminal. If not, add its installation directory (e.g., `C:\Program Files\NVIDIA Corporation\NVSMI` on Windows or `/usr/bin` on Linux) to your system's PATH.
affects: All versions
gotchaGPU temperature reporting and robust Windows support were significantly improved and added in version 1.4.0. Users on older versions will not have access to the `gpu.temperature` attribute or may experience issues on Windows.
fix
Upgrade to GPUtil version 1.4.0 or newer to access GPU temperature information and improved compatibility on Windows: `pip install --upgrade GPUtil`.
affects: < 1.4.0
gotchaFor Python 2.x users, versions of GPUtil prior to 1.2.3 had a bug that caused GPU memory utilization to always show as 0% due to integer division issues. This bug was not present in Python 3.x.
fix
If using Python 2.x, ensure you are on GPUtil version 1.2.3 or newer. Alternatively, upgrade to Python 3.x, where this issue was not present.
affects: Python 2.x versions < 1.2.3
Upgrade
Version history
1.4.0latest on PyPI · released Dec 18, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
gputil — pip install gputil · libregistry