GPStat is a command-line utility for monitoring NVIDIA GPU status and usage, offering a more concise and user-friendly alternative to `nvidia-smi`. It provides essential GPU information including temperature, utilization, memory usage, and running processes. The library, currently at version 1.1.1, maintains an active development cycle with regular updates.
pip install gpustatVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically query NVIDIA GPU status using `gpustat.new_query()` to retrieve a collection of `GPUStat` objects and print their details. It also includes an example for getting JSON-formatted output.
Upgrade your Python environment to 3.6 or newer. If Python 2 compatibility is essential, use `gpustat<1.0` (though this is not recommended due to lack of updates).
Upgrade your NVIDIA display driver to version R450.00 or newer. Ensure `nvidia-ml-py` is installed via `pip install nvidia-ml-py`.
Use `pip install nvidia-ml-py`. Avoid `pip install pynvml`.
Before running CUDA programs, set `export CUDA_DEVICE_ORDER=PCI_BUS_ID`.
Ensure your user's local bin directory (e.g., `~/.local/bin` on Linux) is added to your PATH. You can often fix this by adding `export PATH=$PATH:$HOME/.local/bin` to your shell's configuration file (e.g., `.bashrc` or `.zshrc`) and then sourcing it.
Make sure you have installed `gpustat` in the correct environment (e.g., `pip install gpustat`) and that the environment is activated. If installed globally, ensure the Python environment where it's installed is active.
Verify that NVIDIA drivers are correctly installed and up-to-date, and that the NVML library is accessible. For Linux, ensure `libnvidia-ml.so.1` is in a standard library path (or linked correctly), and for Windows, ensure `nvml.dll` is in a discoverable location. Running `nvidia-smi` successfully is a good indicator of driver health. If the driver is too old, consider `pip install gpustat<1.0` or updating the driver.
Upgrade both `gpustat` and `nvidia-ml-py` to their latest compatible versions using `pip install --upgrade gpustat nvidia-ml-py` or downgrade `gpustat` to an older version (e.g., `gpustat==1.0.0`) if the driver/pynvml versions are fixed.
Install the `ncurses` development library for your system. On Debian/Ubuntu: `sudo apt-get install libncurses5-dev libncursesw5-dev`. On CentOS/Fedora: `sudo yum install ncurses-devel` or `sudo dnf install ncurses-devel`. Then reinstall/recreate your Python environment to link `_curses` correctly.