Skip to content

Is nvgpu a critical dependency or can it be replaced with nvidia-ml-py? #2159

@matthewfeickert

Description

@matthewfeickert

In desc-opt nvgpu is once for a gpu_info call

DESC/desc/__init__.py

Lines 90 to 96 in 2471d55

if kind == "gpu":
# Set CUDA_DEVICE_ORDER so the IDs assigned by CUDA match those from nvidia-smi
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
import nvgpu
try:
devices = nvgpu.gpu_info()

Is there a modern alternative library that is supported that can be used instead?

https://github.com/rossumai/nvgpu seems to be not actively maintained and has a dependency on pynvml for all non-EOL Python

$ pixi exec norwegianblue python
┌───────┬────────────┬─────────┬────────────────┬────────────┬────────────┬──────────┐
│ cycle │  release   │ latest  │ latest release │  support   │    eol     │   pep    │
├───────┼────────────┼─────────┼────────────────┼────────────┼────────────┼──────────┤
│ 3.14  │ 2025-10-07 │ 3.14.4  │   2026-04-07   │ 2027-10-01 │ 2030-10-31 │ PEP-0745 │
│ 3.13  │ 2024-10-07 │ 3.13.13 │   2026-04-07   │ 2026-10-01 │ 2029-10-31 │ PEP-0719 │
│ 3.12  │ 2023-10-02 │ 3.12.13 │   2026-03-03   │ 2025-04-02 │ 2028-10-31 │ PEP-0693 │
│ 3.11  │ 2022-10-24 │ 3.11.15 │   2026-03-03   │ 2024-04-01 │ 2027-10-31 │ PEP-0664 │
│ 3.10  │ 2021-10-04 │ 3.10.20 │   2026-03-03   │ 2023-04-05 │ 2026-10-31 │ PEP-0619 │
│ 3.9   │ 2020-10-05 │ 3.9.25  │   2025-10-31   │ 2022-05-17 │ 2025-10-31 │ PEP-0596 │
│ 3.8   │ 2019-10-14 │ 3.8.20  │   2024-09-06   │ 2021-05-03 │ 2024-10-07 │ PEP-0569 │
│ 3.7   │ 2018-06-27 │ 3.7.17  │   2023-06-05   │ 2020-06-27 │ 2023-06-27 │ PEP-0537 │
│ 3.6   │ 2016-12-23 │ 3.6.15  │   2021-09-03   │ 2018-12-24 │ 2021-12-23 │ PEP-0494 │
│ 3.5   │ 2015-09-13 │ 3.5.10  │   2020-09-05   │   False    │ 2020-09-30 │ PEP-0478 │
│ 3.4   │ 2014-03-16 │ 3.4.10  │   2019-03-18   │   False    │ 2019-03-18 │ PEP-0429 │
│ 3.3   │ 2012-09-29 │ 3.3.7   │   2017-09-19   │   False    │ 2017-09-29 │ PEP-0398 │
│ 3.2   │ 2011-02-20 │ 3.2.6   │   2014-10-12   │   False    │ 2016-02-20 │ PEP-0392 │
│ 2.7   │ 2010-07-03 │ 2.7.18  │   2020-04-19   │   False    │ 2020-01-01 │ PEP-0373 │
│ 3.1   │ 2009-06-27 │ 3.1.5   │   2012-04-06   │   False    │ 2012-04-09 │ PEP-0375 │
│ 3.0   │ 2008-12-03 │ 3.0.1   │   2009-02-12   │   False    │ 2009-06-27 │ PEP-0361 │
│ 2.6   │ 2008-10-01 │ 2.6.9   │   2013-10-29   │   False    │ 2013-10-29 │ PEP-0361 │
└───────┴────────────┴─────────┴────────────────┴────────────┴────────────┴──────────┘

and pynvml actively warns users to not use it

$ uv venv
Using CPython 3.14.4
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
$ . .venv/bin/activate
$ uv pip install pynvml
Resolved 2 packages in 317ms
Prepared 2 packages in 47ms
Installed 2 packages in 6ms
 + nvidia-ml-py==13.595.45
 + pynvml==13.0.1
$ python -c 'import pynvml'
<string>:1: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.

As nvidia-ml-py is still actively maintained by NVIDIA (last release was on 2026-03-19) is it reasonable to just replace the one nvgpu call in the codebase with a function that does the same thing using nvidia-ml-py commands?


Full disclosure: This issue is motivated by Issue #2149.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions