Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 23, 2025

The pynvml package has been deprecated in favor of nvidia-ml-py, causing a FutureWarning to be raised whenever batchflow.monitor is imported:

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.

This PR updates the dependency to use the maintained nvidia-ml-py package instead:

Changes made:

  • Updated pyproject.toml to replace "pynvml" with "nvidia-ml-py" in monitor optional dependencies
  • Updated error message in GPUResourceMonitor.__init__() to reference nvidia-ml-py

Why this works:
The nvidia-ml-py package provides the exact same pynvml module interface without deprecation warnings. No API changes were needed - all existing imports and function calls remain identical:

import pynvml  # Still works, but now from nvidia-ml-py
pynvml.nvmlInit()  # Same API
pynvml.nvmlDeviceGetHandleByIndex(0)  # Same API

Users installing batchflow[monitor] will now get the maintained package without any breaking changes to existing code.

Fixes #799.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Author

Copilot AI commented Sep 23, 2025

@AlexeyKozhevin 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@Copilot Copilot AI changed the title [WIP] pynvml: deprecation warning Replace deprecated pynvml with nvidia-ml-py to fix FutureWarning Sep 23, 2025
@Copilot Copilot AI requested a review from AlexeyKozhevin September 23, 2025 15:58
Copilot finished work on behalf of AlexeyKozhevin September 23, 2025 15:58
@AlexeyKozhevin AlexeyKozhevin changed the base branch from master to r0.9.4 September 24, 2025 16:00
@AlexeyKozhevin AlexeyKozhevin marked this pull request as ready for review September 24, 2025 16:00
@AlexeyKozhevin AlexeyKozhevin requested a review from a team as a code owner September 24, 2025 16:00
@AlexeyKozhevin AlexeyKozhevin merged commit 4feba9c into r0.9.4 Sep 25, 2025
21 checks passed
@AlexeyKozhevin AlexeyKozhevin deleted the copilot/fix-799 branch September 25, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pynvml: deprecation warning

2 participants